2017-04-07 7 views
0

私はopen.windowを許可し、素晴らしいHTMLファイルの1つにアクセスできるjquery行があります。サンプルコードをご覧ください。私はwindow.openでを追加したいIframeで追加するには

<?php if (isset($_SESSION['currentfile'])) { ?> 
$("#sourcepreviewout").click(function() { 
window.open("<?php $dir = "template/" . trim(file_get_contents("admin/template.txt")) . "/result/"; 
echo $dir . $_SESSION['currentfile']; 
?>", '_blank'); 
}); 
<?php } ?> 
}); 

は、...どのように私は、ウィンドウのオープンに200pxので200pxのサイズで<Iframe>を追加し、の内部にHTMLファイルを表示するためにコードを書くことができます!

答えて

0

このjQueryの必要はありません。あなたはJavascriptで非常に簡単にすることができます。

// Change "src" of iframe with your html Link 
var iframe = "<iframe src='https://wiki.selfhtml.org/wiki/JavaScript/Window/open' width='200' height='200'></iframe>"; 

var openWindow = window.open("", "Opened Window", "width=500,height=500,location=no"); 

openWindow.document.write(iframe); 

例:https://jsfiddle.net/06hpd7p7/1/

私は、これはあなたが

必要なものを、すべてだと思います
関連する問題