js子窗口父窗口问题 假设有一个父窗口下有两个子窗口,目前页面在其中一个子窗口下,如何操作另一个子窗口 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 父窗口 中 打开时用:win1 = window.open(...);win2 = window.open(...);子窗口调用:opener.win2.document.XXXX main.html<html><body> <iframe src="sub1.html" frameborder="0"></iframe> <iframe src="sub2.html" frameborder="0"></iframe></body></html>sub1.html<html><body><h1>sub1</h1></body></html>sub2.html<html><body><h1>sub2</h1><input id="change" type="button" value="change sub1" /><script>void function(){ document.getElementById('change').onclick = function(){ var iframes = parent.document.getElementsByTagName('iframe'); for(var i = 0; iframe = iframes[i++];){ if (/sub1\.html/.test(iframe.src)){ var h1 = iframe.contentDocument.getElementsByTagName('h1')[0]; if (h1) h1.innerHTML = ['sub1', +new Date]; } } };}();</script></body></html>3个页面,必须同域 radio 绑定数据后怎么点击某一行数据获取某一行的值 如何用Jquery 获取asp.net控件属性 javascript的css改变 60分求救 有谁知道Server端JavaScript? form里不能响应向上或向下的键盘事件? table中的数据导到EXCEL的问题 独孤龙大哥,及各位大哥大姐救小弟我!(我没分了,实在对不起) 为什么要点两下才执行啊 【求助攻】jquery 年会抽奖,搞不定啊 JS表单验证 easyui中dialog拖动功能(有iframe情况)
win1 = window.open(...);
win2 = window.open(...);子窗口调用:
opener.win2.document.XXXX
<body>
<iframe src="sub1.html" frameborder="0"></iframe>
<iframe src="sub2.html" frameborder="0"></iframe>
</body>
</html>
sub1.html
<html>
<body>
<h1>sub1</h1>
</body>
</html>
sub2.html
<html>
<body>
<h1>sub2</h1>
<input id="change" type="button" value="change sub1" />
<script>
void function(){
document.getElementById('change').onclick = function(){
var iframes = parent.document.getElementsByTagName('iframe');
for(var i = 0; iframe = iframes[i++];){
if (/sub1\.html/.test(iframe.src)){
var h1 = iframe.contentDocument.getElementsByTagName('h1')[0];
if (h1) h1.innerHTML = ['sub1', +new Date];
}
}
};
}();
</script>
</body>
</html>3个页面,必须同域