如何使iframe外部的超级链接的页面在iframe中打开

如何使iframe外部的超级链接的页面在iframe中打开,有以下两种方法:

 一、html方法:

<iframe name="a1"></iframe>  
<a href="http://www.lingdublog/" target="a1">零度博客</a>

二、javascript方法:

<iframe id="a1"></iframe>  
<a href="http://www.lingdublog.cc"  onclick="document.frames('a1').location=this.href;return false">零度博客</a>

反过来,如何在父窗口中打开iframe中的链接,有以下四种方法:

一、html方法

1、

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

2、

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

二、javascript方法

 1、

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

2、

<a   href="#"   onclick=window.top.location.href=""></a>
原文地址:https://www.cnblogs.com/lingdublog/p/6438045.html