我应该用什么来代替document.write来做一个弹出窗口 [英] what should I use instead of document.write for a popup

查看:438
本文介绍了我应该用什么来代替document.write来做一个弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的网页中,我打开一个弹出窗口并使用JavaScript / jQuery为弹出窗口生成HTML:

in my web page, I am opening a popup window and generate the HTML for the popup using JavaScript/jQuery:

var site="<html> ............. </html>";
var popupWindow = window.open("","","menubar=0,scrollbars=0");
popupWindow.document.write(site);

问题是,弹出窗口在状态栏中显示正在读取。我应该用什么来代替document.write()?

The problem is, that the popup window shows "reading" in the status bar. What should I use instead of document.write()?

编辑:

document.close();

应该这样做,谢谢。不幸的是,我的框架可能会干扰,所以它在FF中不适合我。 IE浏览器工作。

should do the work, thanks. Unfortunately, my framework may be interfering, so it's not working for me in FF. IE works.

推荐答案



You have to close the document when you'r done writing:

var site="<html> ............. </html>";
var popupWindow = window.open("","","menubar=0,scrollbars=0");
popupWindow.document.write(site);
popupWindow.document.close();

这篇关于我应该用什么来代替document.write来做一个弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆