document.write 不般不用于ajax显示数据,一般用innerHTML看下这个入门实例:
http://www.37dg.com/tutorial/209.jspshow_str=getElementById("d1");
show_str.innerHTML=ajax.responseText; //这两句显示文字,如果把这两句换成document.write(ajax.responseText)你会发觉读取的页面改变了内容,但本页面的ajax还未更新。
http://www.37dg.com/tutorial/209.jspshow_str=getElementById("d1");
show_str.innerHTML=ajax.responseText; //这两句显示文字,如果把这两句换成document.write(ajax.responseText)你会发觉读取的页面改变了内容,但本页面的ajax还未更新。
当document完成close后,再document.write,就会覆盖重新document。
于是就出现这样的情况了。