<script>
function printPreview()
{
var printWindow = window.open("","");
var str = "<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0></OBJECT>"
var s ="<html>\r\n";
s += "<head>";
s += "<LINK href='../../pic/broker30.css' type='text/css' rel='stylesheet'>";
s += "<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>";
s += "</head>";
s += "<body><center><br>";
s += "<div align=center style='width:96%'>";
s += "这就是一个新开页面且自动打印预览的例子";
s += "</div>";
s += "</center></body>";
s += "</html>";
printWindow.document.write(s);
printWindow.document.close();
printWindow.document.body.insertAdjacentHTML("beforeEnd", str);
printWindow.document.all.WebBrowser.ExecWB(7,1);
printWindow.close();
}
</script>
<body>fsfsdfdsfdsf<input type="button" id="btn_yes" onclick="printPreview()" value="打印"></body>
function printPreview()
{
var printWindow = window.open("","");
var str = "<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0></OBJECT>"
var s ="<html>\r\n";
s += "<head>";
s += "<LINK href='../../pic/broker30.css' type='text/css' rel='stylesheet'>";
s += "<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>";
s += "</head>";
s += "<body><center><br>";
s += "<div align=center style='width:96%'>";
s += "这就是一个新开页面且自动打印预览的例子";
s += "</div>";
s += "</center></body>";
s += "</html>";
printWindow.document.write(s);
printWindow.document.close();
printWindow.document.body.insertAdjacentHTML("beforeEnd", str);
printWindow.document.all.WebBrowser.ExecWB(7,1);
printWindow.close();
}
</script>
<body>fsfsdfdsfdsf<input type="button" id="btn_yes" onclick="printPreview()" value="打印"></body>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货