在这个波纹管程序中,如果你点击'PRINT',html内容将被添加到新的弹出窗口b.html中。它工作正常,但b.html有一些html内容,当新的弹出窗口打开时,我正在丢失这些数据。在不缺少b.html的html内容的情况下,我如何在内部添加新的html内容。新的弹出窗口有问题吗?
我的示例代码:
页面名称:a.html
<html>
<head>
<script type="text/javascript" src="js/jquery-1.6.1.min.js"> </script>
<script type="text/javascript">
$(document).ready(function()
{
$("#print").click(function()
{
var newWind=window.open('b.html', 'Print message',"left=100,screenX=200,menubar=yes, width=980,height=500, location=yes,resizable=yes,scrollbars=yes,status=yes");
var printableHTML=$("#msg").html();
newWind.document.write(printableHTML);
//newWind.append(printableHTML);
});
});
</script>
</head>
<body>
<span id="print"><u>PRINT</u></span>
<div id="msg">
<h4> I am printing this message...</h4>
</div>
</body>
</html>
页面名称:b.html
<html>
<head> </head>
<body>
<h4>Hello</h4>
<div id="target"></div>
</body>
</html>
如果您的帖子的代码一面墙,如果你把它的赞赏一个[jsfiddle.net ](http://jsfiddle.net)链接! –
什么浏览器?为我工作很好:http://jsfiddle.net/pPdwC/ –