2014-03-13 219 views
0
<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> 

我有一個包含iframe的頁面。我有打開iframe內部頁面的鏈接,所以iframe不只有一個常量源。我希望有一個鏈接可以打開iframe中當前的任何源代碼到新窗口中,無論是1.html,2.html還是3.html等(更多頁面將不斷添加,未來只有三個)。如何打開將iframe源打開到新窗口的iframe之外的鏈接?

我將如何實施此鏈接?提前感謝你! :〜)

回答

0

試試這個,

$(function(){ 
    $('a[target="blah"]').on('click',function(e){ 
     e.preventDefault(); 
     window.open(this.href,'blah'); 
    }); 
});