我正在尝试从javascript打开一个新窗口,但没有插入html:
var callScriptText = $('#callScriptText').html(); var url = '/Action/CallScript/?callScript='; // Open the current call script in a new window var openWindow = window.open(url, 'callScriptPopup', 'width = 500, height = 500'); $(openWindow).html(callScriptText);
有人知道为什么吗?
这是一个使用jQuery打开包含内容的新窗口的示例
<script> function nWin() { var w = window.open(); var html = $("#toNewWindow").html(); $(w.document.body).html(html); } $(function() { $("a#print").click(nWin); }); </script> <div id="toNewWindow"> <p>Your content here</p> </div> <a href="javascript:;" id="print">Open</a>