当我尝试使用JavaScript的window.print()打开和打印窗口时,在Chrome中打印时,图片不会显示。我的代码如下:
<html>
<head>
<script type="text/javascript">
function openWin()
{
var myWindow = window.open('','', 'width=200,height=100');
myWindow.document.write("<p>This is 'myWindow'</p>");
myWindow.document.write("<p><img src='https://www.google.gr/images/srpr/logo11w.png' width='400' /></p>");
myWindow.document.close();
myWindow.focus();
myWindow.print();
myWindow.close();
}
</script>
</head>
<body>
<input type="button" value="Open window" onclick="openWin()" />
</body>
</html>
你可以在这里查看 http://jsfiddle.net/Q5Xc9/649/。
怎样解决这个问题?