打印

1.在页面<head>标签中加上如下代码:

<object id='factory' classid='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2' height='0' width='0'></object>

2.调用打印方法

<script type="text/javascript">
function OnPrint() {
var htm = document.getElementById("txtHtml").value;
//var o = WebApp.PIS_ApplyInfoDetailPH.GetPtintHTML(htm);
//if (o != null) {
if (htm.length >= 0) {
var old = document.body.innerHTML;
//document.body.innerHTML = o.value;
document.body.innerHTML = htm;
document.all.factory.ExecWB(6, 1);
document.body.innerHTML = old;

}
}
</script>

 

posted @ 2016-01-15 16:49  小孙^_^  阅读(91)  评论(0编辑  收藏  举报