<html><head></head><script>var title = "hello";var time = 0;var author = "vickenyang";var email = "ycg01@software.nju.edu.cn";</script><body><div id="div_1"><SPAN style="display: none">hidden</SPAN>hehe <!--bs--> <script> document.write("first"); </script> <!--es--> 这是第一个页面! <br> <!--bs--> <script> time++; document.write(title+time+author); //alert(time); document.write("<br>---------------"); </script> <!--es--> <input type="text" name="test" value="test"></div><script>function refreshDiv(div){var html = "";function changediv(){ var oldwrite = document.write; var oldwriteln = document.writeln; document.write = function(str) { html += str; } document.writeln = function (str) { html += str + "\n"; } var htmlTmp = div.innerHTML; //ie默认大写,添加为支持firefox,美中不足,会替换所有script值,如果只是ie应用,可注销此行 htmlTmp = htmlTmp.replace(/script/gi,"SCRIPT"); //alert(htmlTmp); var pos_1 = 0; var pos_2 = 0; pos_1 = htmlTmp.indexOf("<SCRIPT>",pos_1); while(pos_1 != -1) { html += htmlTmp.substring(pos_2,pos_1); var pos_3 = htmlTmp.indexOf("</SCR"+"IPT>",pos_1); html += htmlTmp.substring(pos_1,pos_3+"<-SCRIPT>".length); pos_2 = pos_1+"<SCRIPT>".length; eval(htmlTmp.substring(pos_2,pos_3)); pos_2 = htmlTmp.indexOf("<!--es-->",pos_3); pos_1 = htmlTmp.indexOf("<SCRIPT>",pos_1+1); } html += htmlTmp.substring(pos_2,htmlTmp.length); document.write = oldwrite; document.writeln = oldwriteln;}eval("changediv();");div.innerHTML = html;}function change(){refreshDiv(document.getElementById('div_1'));}function change2(){document.write("over");}</script><input type="button" value="change" onclick="change();"><input type="button" value="change2" onclick="change2();"></body></html>