首页 新闻 会员 周边

在iframe1中如何获得iframe2的引用?(急)

0
悬赏园豆:30 [已解决问题] 解决于 2010-07-14 17:51

在框架中点击iframe1中的链接,要改变iframe2中的内容!改怎么做?最好有代码!

選擇yí莣的主页 選擇yí莣 | 初学一级 | 园豆:31
提问于:2010-07-14 16:12
< >
分享
最佳答案
0

a.html:

 

<html>
<body>
<script type="text/javascript">
function show()
{
alert(document.getElementById("frame2").src);
}
</script>
<iframe name="frame2" id="frame2"  src="ab.html"></iframe>
<iframe name="frame3" id="frame3"  src="axx.html"></iframe>
<button onclick="show()">测试</button>
</body>
</html>

<html>
<body>

<script type="text/javascript">

function show(){ alert(document.getElementById("frame2").src);}

</script>
<iframe name="frame2" id="frame2"  src="ab.html"></iframe>

<iframe name="frame3" id="frame3"  src="axx.html"></iframe>
<button onclick="show()">测试</button>

</body>

</html>

ab.html:

<html>

<body>

<script type="text/javascript">

function show()

{

alert(parent.document.getElementById("frame2").src);

}

</script>

<button onclick="show()">测试</button>

</body>

</html>


收获园豆:20
镜涛 | 小虾三级 |园豆:575 | 2010-07-14 17:13
分别是获取本窗体内的iframe和获取父窗体内的iframe
镜涛 | 园豆:575 (小虾三级) | 2010-07-14 17:14
其他回答(1)
0

在iframe1中使用parent来获取父页面的iframe2。

收获园豆:10
Astar | 园豆:40805 (高人七级) | 2010-07-14 16:26
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册