父页面如何给动态打开的IFRAME子页面赋值 本帖最后由 lxf3483 于 2011-06-27 19:19:09 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 A.html<input type='button' value='openFrame' onclick='openFrame()'/><iframe ID='subpage' src=''></iframe><script type="text/javascript">function openFrame(){ var ifm= document.getElementById("subpage") ifm.src='B.html' function isload() { if(ifm.contentWindow.document.readyState == "complete") { ifm.contentWindow.document.getElementById("subtext").value="11111111111" window.clearInterval(i); } } var i = window.setInterval(isload,10)}</script> 在A页面中用document.getElementById('subpage').contentWindow.document.getElementById('subtext')这里用一个contentWindow就可以。当时于B.html里的window--------------------------------------帅签分割线------------------------------------------------- document.getElementById('subpage').contentWindow.document.getElementById('subtext')主要是这句,contentWindow这个属性。 感谢 aspwebchh ,我所要的就是这个答案,在页面读取完成后再给页面赋值。 求解 在线 各位帮忙测试一下代码?不长。 快捷键问题 关于菜单点击后变色的问题 EasySlider发布,顺便散分祝大家新年快乐! 调用JS函数传递字符串时,为什么有的要用单引号、有的是双引号? 谁能帮我解释一下 新手,提问:在XP系统中能不能大搭建WEB服务器,需要安装什么软件? 哪位大侠知道在网页如何防止用户按Ctrl+N键去查看源代码 我要类似 http://jqueryui.com/tabs/#sortable 他时标签 能调整顺序 但也能添加删除标签 修改 火狐中的记住密码功能 iframe 中 内存一直增长 谁有遇到过 如何解决
<input type='button' value='openFrame' onclick='openFrame()'/>
<iframe ID='subpage' src=''></iframe>
<script type="text/javascript">
function openFrame(){
var ifm= document.getElementById("subpage")
ifm.src='B.html'
function isload()
{
if(ifm.contentWindow.document.readyState == "complete")
{
ifm.contentWindow.document.getElementById("subtext").value="11111111111"
window.clearInterval(i);
}
}
var i = window.setInterval(isload,10)
}
</script>
document.getElementById('subpage').contentWindow.document.getElementById('subtext')
这里用一个contentWindow就可以。当时于B.html里的window
--------------------------------------帅签分割线-------------------------------------------------
主要是这句,contentWindow这个属性。