javascript - 无法在 JavaScript 中写入新的弹出窗口

标签 javascript

我写了一个火狐插件。 我有代码:

var myWindow=window.open('','_blank','width=200,height=100');
myWindow.document.write("<p>lala</p>");  

窗口确实创建了,但没有写入任何内容。 这是为什么?

最佳答案

据我所知,您必须手动打开然后关闭文档:

var myWindow=window.open('','_blank','width=200,height=100');
myWindow.document.open();
myWindow.document.write("<p>lala</p>");  
myWindow.document.close();

关于javascript - 无法在 JavaScript 中写入新的弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7944978/

相关文章:

Javascript Jquery 动态表单数据序列化

javascript - Bootstrap 3 - IE9 Bug 上的不可见下拉列表。使固定?

php - PHP-mySQL 生成表的 ShowMore 按钮

javascript - 循环遍历集合,根据操作属性将每个项目推送到新集合

javascript - jquery 日期选择器 ajax

javascript - 嵌套 For 循环按什么顺序运行?

javascript - 在 enzyme 中模拟 history.back()

javascript - Angular : Sort by list of properties with mixed ASC and DESC

javascript - 准备使网站与 Internet Explorer 8 兼容

javascript - 在 js 运行之前,我必须在我的提交按钮上单击两次。为什么?