社区
JavaScript
帖子详情
在线,document.write
kingdomzhf
2003-07-30 04:21:28
var oW = window.createPopup();
var oIF = oW.document.createElement("iframe");
OIF.id = "pp";
oW.document.all("pp");//存在
oIF.document.write("<div></div>");
oW.document.all("pp");//不存在---为什么,write时是不同的document啊
...全文
38
14
打赏
收藏
在线,document.write
var oW = window.createPopup(); var oIF = oW.document.createElement("iframe"); OIF.id = "pp"; oW.document.all("pp");//存在 oIF.document.write(""); oW.document.all("pp");//不存在---为什么,write时是不同的document啊
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
14 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
liuruhong
2003-07-31
打赏
举报
回复
在document.write之后,并没有完成整个页面的load,这个时候当然不可以访问了,最好不要出现createElement和write同时使用的情况
如果你需要使用document.write
可以这么写
var oDoc=oPopup.document;
oDoc.open();
oDoc.write(....)
oDoc.close();
这个时候就可以访问你使用document.write的对象了
kingdomzhf
2003-07-30
打赏
举报
回复
up
kingdomzhf
2003-07-30
打赏
举报
回复
继续讨论
kingdomzhf
2003-07-30
打赏
举报
回复
1.to xiaoshi:不是覆盖,而是对象没了
2.在popup中创建的iframe,它的属性contentWindow会出错
本来想用contentWindow.document.write
xuzuning
2003-07-30
打赏
举报
回复
oW (popup)
oIF (iframe)
如果是写到iframe要
oIF.iframename.document.write
kingdomzhf
2003-07-30
打赏
举报
回复
popwindow.document == popwindow.iframe.document ?
jsidiot
2003-07-30
打赏
举报
回复
但是为什么这么写不覆盖呢?
<iframe name=t ></iframe>
<script>
//t.designMode = 'on';
t.document.write("<div>sadfasdfasd</div>");
t.document.write("<div>sadfasdfasd</div>");
</script>
xuzuning
2003-07-30
打赏
举报
回复
请注意:
oIF.id = "pp";
oIF.document.write("<div></div>");
是对同一个对象的,document.write将覆盖该对象的原有内容
oIF.id = "pp";
与
oIF.document.id = "pp";
是等价的
kingdomzhf
2003-07-30
打赏
举报
回复
没人响应
人气不够旺
kingdomzhf
2003-07-30
打赏
举报
回复
up
kingdomzhf
2003-07-30
打赏
举报
回复
<body>
<script>
var oW = window.createPopup();
var oIF = oW.document.createElement("iframe");
oW.document.body.appendChild(oIF);
oIF.id = "pp";
alert(oW.document.all("pp"));//存在
oIF.document.write("<div></div>");
alert(oW.document.all("pp"));//不存在---为什么,write时是不同的document啊
</script>
</body>
jsidiot
2003-07-30
打赏
举报
回复
怎么我执行的时候
oIF.id = "pp";
提示对象不执行此操作?
可能是由于不同的document,在原来的document里面又增加了.是不是就改变了对象呢?
不清楚
kingdomzhf
2003-07-30
打赏
举报
回复
up
kingdomzhf
2003-07-30
打赏
举报
回复
var oW = window.createPopup();
var oIF = oW.document.createElement("iframe");
oW.document.body.appendChild(oIF);
OIF.id = "pp";
oW.document.all("pp");//存在
oIF.document.write("<div></div>");
oW.document.all("pp");//不存在---为什么,write时是不同的document啊
document
.
write
和innerHTML的区别
document
.
write
在执行的时候,会先执行dcument.open,如果不存在
document
.open这样一个方法,浏览器会默认执行。每一次执行
document
.
write
()都会对上一次的内容进行覆盖。innerHTML是dom元素的一个属性,代表dom元素...
document
.
write
()详解
一、
document
.
write
()运行原理 首先我们先了解一下这条...它能够直接砸文档流中写入字符串,一旦文档流已经关闭,那么
document
.
write
()就会重新运用
document
.open()打开新的文档流并写入,此时原来的文档流会被清.
document
.
write
()怎么样支持html,如何使用
document
.
write
()方法写入当前html页面?
我在javascript中使用
document
.
write
()方法来填充点击按钮后的一些数据(在表中)。...所以我的代码, 而且我的JavaScript的方法是:function PopulateData(){ // alert("hello");
document
.
write
("22Pa...
JavaScript 中
document
.
write
() 详细用法介绍
document
.
write
() 用法 在JavaScript中
document
.
write
()函数可以向文档写入HTML表达式或JavaScript代码,用法“
document
.
write
(exp1,exp2,exp3,…)”,该函数可接受任何多个参数,并将其写入文档中。
document
.
write
...
document
.
write
()和innerHTML的区别
document
.
write
()和innerHTML是JavaScript的显示方式 1.inner HTML 对于inner HTML,w3c给出的解释是: inner HTML可以写入(改变)HTML元素内容 2.
document
.
write
() 对于
document
.
write
(),w3c给出的解释是 ...
JavaScript
87,907
社区成员
224,614
社区内容
发帖
与我相关
我的任务
JavaScript
Web 开发 JavaScript
复制链接
扫一扫
分享
社区描述
Web 开发 JavaScript
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章