Javascript:document.write("hello world") 起初可以工作,但如果您更改文本,它不适用于下一个文本。
重现:在您的地址栏中:
输入http://nazmulweb.com 或任何其他网址
加载页面后,输入 Javascript:document.write("hello world")
浏览器会显示“hello world”,不是吗?
然后输入 javascript:document.write('hello stackoverflow users!')
这次浏览器不更新文本。可能是什么原因?
“我的目标是什么?”
我正在使用以下代码在 Iframe 中编写
function writeInIframe(data){
var previewWindow=$("pwFrame").contentWindow;
if (previewWindow.document) {
previewWindow.document.open();
previewWindow.document.write(data);
previewWindow.document.close();
}
}
第一次在 Iframe 中正确显示数据,但后来,新数据不会在 Iframe 中更新。