关于打印问题
<head><title></title>
<script type="text/javascript" src="js/public/jquery.js"></script>
<script type="text/javascript" src="js/public/jquery-extend.js"></script>
<script type="text/javascript" src="js/public/jquery.PrintArea.js"></script>
<script type="text/javascript">
function GetQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]); return null;
}
function Load() {
var photoUrl = GetQueryString("photoUrl");
var photoHtml = "<div id=\"photoImgDiv\"><img src=\'" + photoUrl + "\' style=\" max-width:100%;\"></div>";
$("#photoDiv").html(photoHtml).trigger("create");
}
function printPhoto() {
$("#photoImgDiv").printArea();
}
</script>
</head>
<body onload="Load()">
<button type="button" onclick="printPhoto()">打印</button>
<div id="photoDiv"></div>
</body>
用谷歌浏览器为什么预览的时候都是空白的,看不到图片呀,郁闷!!
function printPhoto() {
var ele = document.getElementById("photoDiv");
var w = window.open('about:blank');
setTimeout(function () {
w.document.body.innerHTML = ele.innerHTML;
w.print();
}, 100);
}
另一种方法火狐与IE可以,谷歌浏览器也是空白
求解哦