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

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

從父頁面重定向 iframe

從父頁面重定向 iframe

慕婉清6462132 2024-01-11 17:30:19
我有一個疑問,如何從其父頁面重定向 iframe?我有這個if(($mypassword == "home.guava")) {     echo "<script>window.top.location.href = \"teste\";</script>"; }在我附加到 iframe 頁面的 php 文件中。但我需要的是這樣的東西,它將從父頁面重定向 iframe!謝謝大家:D
查看完整描述

1 回答

?
狐的傳說

TA貢獻1804條經驗 獲得超3個贊

如果腳本位于父級中,則不必遇到問題。


if(($mypassword == "home.guava")) {

    echo "<script>document.getElementsByTagName('iframe')[0].src = \"teste\";</script>";

}


例子:


<body>

  <iframe id="one" src="url"></iframe>

  <iframe id="two" src="url"></iframe>

</body>

// Parent to child:

document.getElementsById('one').src = url;


// Child to parent

window.parent.location.href = url;


// Child to other child

window.parent.document.getElementById('two').src = url;


// Current (Child or Parent)

window.location.href = url;


查看完整回答
反對 回復 2024-01-11
  • 1 回答
  • 0 關注
  • 175 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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