如何使iframe外部的超級鏈接的頁面在iframe中打開a標簽鏈接


如何使iframe外部的超級鏈接的頁面在iframe中打開a標簽鏈接,有以下兩種方法:

 一、html方法:

<iframe name="a1"></iframe>  
<a href="http://www.baidu.com" target="a1">百度</a>

二、javascript方法:
<iframe id="a1"></iframe>  
<a href="http://www.baidu.com"  onclick="document.frames('a1').location=this.href;return false">百度</a>

反過來,如何在父窗口中打開iframe中的鏈接,有以下四種方法:

一、html方法 2種

<a   href=""   target="_top"></a>  
<a   href=""   target="_parent"></a>  

二、javascript方法 2種

<a   href="#"   onclick=window.parent.location.href=""></a>  
<a   href="#"   onclick=window.top.location.href=""></a>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM