亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

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

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

達令說 2018-12-07 04:45:07
在框架中點擊iframe1中的鏈接,要改變iframe2中的內容!改怎么做?最好有代碼!
查看完整描述

2 回答

?
桃花長相依

TA貢獻1860條經驗 獲得超8個贊

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>


查看完整回答
反對 回復 2019-01-21
?
Qyouu

TA貢獻1786條經驗 獲得超11個贊

在iframe1中使用parent來獲取父頁面的iframe2。

查看完整回答
反對 回復 2019-01-21
  • 2 回答
  • 0 關注
  • 400 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號