0

Wordpress の投稿に iframe が埋め込まれたページがあり、クリックすると iframe の html ページが新しいウィンドウで開くリンクを iframe に追加したいと考えています。そのiframeのURLを知らなくてもできるようにしたいです。これは可能ですか?ありがとうございました!

4

4 に答える 4

1

window.open を使用してウィンドウを開きます。子ウィンドウの高さ、幅、およびその他のプロパティを設定できます。jsfiddle .

   <a href='javascript:void(0)'  onClick="window.open(location,'_blank','width=800, height=900'); return false;" >Html name </a>

jQuery:

$('a').click(function(){
       window.open(location,'_blank','width=800, height=900'); 
  return false; 

});
于 2012-09-27T11:42:01.357 に答える
1

jquery では、iframe の src 値を javascript window.open() に渡すことができます。

window.open($("iframe.test").attr("src"), "Window Title", "width=300,height=400,left=100,top=200");
于 2012-09-27T11:43:23.823 に答える
0

これを試して

<a href='pathofhtml' target=_blank >Html name </a>
于 2012-09-27T11:38:48.223 に答える
0

jQueryは必要ありません。JavaScript を使用して、ID を使用して iFrame の src を取得できます。

 function popOut() {
        var src = document.getElementById('popOutiFrame').src;
        window.open(src);
    }

次に、ボタンでスクリプトを呼び出します

<button type="button" class="close" data-dismiss="modal"    onclick="popOut()">
    <!--Optional: Font Awesome expand icon-->
    <i class="fa fa-expand" aria-hidden="true"></i>
</button>

<iframe id='popOutiFrame' src='http://example.com'></iframe>

デモ

于 2016-05-19T16:15:07.657 に答える