代码如下: <HTML> <HEAD> <TITLE>加亮显示</TITLE> <style> * {font-size: 14px} </style> <script language="JScript"> function highLight_attribute($1) { var attribute_html = $1 var re = /([\S]+=)(\S+)/g attribute_html = attribute_html.replace(re, "<font color=red>$1</font><font color=black>$2</font>") return attribute_html } function highLight_tag($1) { return "<font color=blue>"+highLight_attribute($1)+"</font>" } function highLight(html) { re = /(<[\S]+?.*?>)/g html = html.replace(re, highLight_tag) html = html.replace(/\n/g, "<br>") html = html.replace(/(\$?\d+(%|px)?)/g, "<font color=red>$1</font>") html = html.replace(/(\".*?\")/g, function($1) { $1 = $1.replace(/<.*?>/g, "") return "<font color=#999999>"+$1+"</font>" }) html_lightcode.innerHTML = html } </script> </HEAD> <BODY onload="html_code.innerText=document.documentElement.outerHTML; highLight(html_code.innerHTML)"> <textarea id=html_code rows=15 style="100%" onkeyup="highLight(html_code.innerHTML)"></textarea> <br> <div id=html_lightcode></div> </BODY> </HTML> [Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]
青苹果Web应用商店 https://webapp.taobao.com/
PHP/ASP.NET/ASP/UCHOME/DISCUZ! X系列网站开发,详细需求联系QQ:8511978