Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何打开iframe外部的链接,将iframe源代码打开到新窗口中?_Javascript_Jquery_Html_Iframe - Fatal编程技术网

Javascript 如何打开iframe外部的链接,将iframe源代码打开到新窗口中?

Javascript 如何打开iframe外部的链接,将iframe源代码打开到新窗口中?,javascript,jquery,html,iframe,Javascript,Jquery,Html,Iframe,我有一个带有iframe的页面。我在iframe中有打开页面的链接,因此iframe没有一个固定的源。我想有一个链接,将打开任何源代码目前在iframe到一个新的窗口,无论是1.html,2.html,或3.html等(更多的网页将不断增加,所以不会只有三个在未来) 我将如何实现此链接?提前非常感谢!:~) 试试这个 <a href="//source of iframe name blah//" target="about:blank">open in new window<

我有一个带有iframe的页面。我在iframe中有打开页面的链接,因此iframe没有一个固定的源。我想有一个链接,将打开任何源代码目前在iframe到一个新的窗口,无论是1.html,2.html,或3.html等(更多的网页将不断增加,所以不会只有三个在未来)

我将如何实现此链接?提前非常感谢!:~)

试试这个

<a href="//source of iframe name blah//" target="about:blank">open in new window</a>

<a href="1.html" target="blah">link 1</a>
<a href="2.html" target="blah">link 2</a>
<a href="3.html" target="blah">link 3</a>

<iframe name="blah" src="blah.html" ></iframe>
$(function(){
    $('a[target="blah"]').on('click',function(e){
       e.preventDefault();
       window.open(this.href,'blah');
    });
});