假定页的基 URL 为:
http://xyz.siroe.com/test/rewriter/test1/jscript/JSFUNC/page.html
页内容
<script> <!-- document.write(\q<a href="/index.html">write</a><BR>\q) document.writeln(\q<a href="index.html">writeln</a><BR>\q) document.write("http://abc.sesta.com/index.html<BR>") document.writeln("http://abc.sesta.com/index.html<BR>") //--> </SCRIPT>
规则
<Function name="DHTML" name="document.write" paramPatterns="y"/> <Function name="DHTML" name="document.writeln" paramPatterns="y"/> <Attribute name="href"/>
输出
<SCRIPT> <!-- document.write(\q<a href="gateway-URL/ http://xyz.siroe.com/index.html">write</a><BR>\q) document.writeln(\q<a href="gateway-URL/ http://xyz.siroe.com/test/rewriter/test1/ jscript/JSFUNC/index.html">writeln</a><BR>\q) document.write("http://abc.sesta.com/index.html<BR>") document.writeln("http://abc.sesta.com/index.html<BR>") //--> </SCRIPT>
描述
第一项规则指定需要重写函数 document.write 中的第一个参数。第二项规则指定需要重写函数 document.writeln 中的第一个参数。第三项规则是一项简单的 HTML 规则,它指定需要重写名为 href 的所有属性。在示例中,DHTML 参数规则将会确定函数中需要重写的参数。然后会应用 HTML 属性规则来实际重写已确定的参数。