js window.open然后print() [英] js window.open then print()
本文介绍了js window.open然后print()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下是测试人员:
< HTML>
< head>
< script type =text / javascript>
函数openWin()
{
myWindow = window.open('','','width = 200,height = 100');
myWindow.document.write(< p>这是'myWindow'< / p>);
myWindow.focus();
myWindow.print(); //不工作
}
< / script>
< / head>
< body>
< input type =buttonvalue =Open windowonclick =openWin()/>
< / body>
< / html>
解决方案
工作范例:
http://jsfiddle.net/Q5Xc9/1/
print() doesn't work in IE after opening a new window. It works in Chrome. Here's a tester:
<html>
<head>
<script type="text/javascript">
function openWin()
{
myWindow=window.open('','','width=200,height=100');
myWindow.document.write("<p>This is 'myWindow'</p>");
myWindow.focus();
myWindow.print(); //DOES NOT WORK
}
</script>
</head>
<body>
<input type="button" value="Open window" onclick="openWin()" />
</body>
</html>
解决方案
checkout: window.print() not working in IE
Working sample: http://jsfiddle.net/Q5Xc9/1/
这篇关于js window.open然后print()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文