Remove all client Script Javascipt,vbscript,jscript,js,vbs,event
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title> Remove all client script javascipt,vbscript,jscript,js,vbs,event</title>
<body>
<div id= ' Browser ' ></div>
<script language= "JavaScript Tutorial" >
function Decodefilter (HTML, filter) {
Switch (Filter.touppercase ()) {
Case "Script"://Remove all client script Javascipt,vbscript,jscript,js,vbs,event,...
html = execre ("</?script[^>]*>", "", HTML);
html = Execre ("(javascript|jscript|vbscript|vbs):", "$:", HTML);
html = Execre ("On" (Mouse|exit|error|click|key), "<I>on$1</I>", HTML);
html = execre ("&#", "<I>&#</I>", HTML);
Break
Case "class"://Remove Style class class= ""
html = Execre ("(<[^>]+) class=[^ |^>]* ([^>]*>)", "$ $", HTML);
Break
Case "style"://Remove style style= ""
html = Execre ("(<[^>]+) style=" [^ "]*" ([^>]*>) "," $ $ ", HTML);
Break
Case "XML"://removing XML
html = execre ("<\?xml[^>]*>", "", HTML);
Break
Case "NAMESPACE"://removal of namespaces <o:p></o:p>
html = execre ("</?[ A-z]+:[^>]*> "," ", HTML);
Break
Case "FONT"://Remove Font <font></font>
html = execre ("</?font[^>]*>", "", HTML);
Break
Case "MARQUEE"://Remove Subtitles <marquee></marquee>
html = execre ("</?marquee[^>]*>", "", HTML);
Break
Case "Object"://Remove Object <object><param><embed></object>
html = execre ("</?object[^>]*>", "", HTML);
html = execre ("</?param[^>]*>", "", HTML);
html = execre ("</?embed[^>]*>", "", HTML);
Break
Default
}
return HTML;
}
// ============================================
Perform regular expression substitution
// ============================================
function Execre (Re, RP, content) {
Oreg = new RegExp (Re, "IG");
R = Content.replace (Oreg, RP);
return R;
}
document.getElementById (' browser '). InnerHTML =br;
</script>
Site original tutorial, reprinted annotated source www.111cn.net
</body>