Hi, all, 我想监视网页的变化, 现在通过 IHTMLChangeSink 能够得到大部分网页变化的通知. 但是我发现页面js调用document.write或者document.writeln写网页 IHTMLChangeSink 似乎没有通知. 试过document.parentWindow.execScript("document.write = function (text) ... 定向到我的函数, 但是有些非常复杂的javascript, 再加上弹出窗, 多frame之类, 容易出错. 如何能得到document.write产生的页面变化通知呢? 谢谢!
<html>
<head>
<script language="javascript">
function Generate()
{
document.write("<table>");
document.write("<tr><td><input type='text' value='text1'>");
document.write("<tr><td><input type='text' value='text2'>");
document.write("</table>");
}
</script>
</head>
<body>
<input type="button" value="GenerateTable" onclick="Generate()">
</body>
</html>
在文档完成之后,基本上很少会再次执行write操作,例外情况是可以在末尾write脚本标签以加载新的脚本。DOM改变不会调用write方法完成,而是通过其它的DOM操作。