JS部分的代码
< object
id= "WebBrowser"
width= "0"
height= "0"
classid= "CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" ></ object >
<!-- <script type= "text/javascript"
src= "/JScript/PrintView/InvoicePrint.js" ></script>-->
<script type= "text/javascript" >
function printNew() {
bdhtml = window.document.body.innerHTML;
sprnstr = "<!--startprint-->" ; //开始打印标识字符串有17个字符
eprnstr = "<!--endprint-->" ; //结束打印标识字符串
prnhtml = bdhtml.substr(bdhtml.indexOf(sprnstr) + 17); //从开始打印标识之后的内容
prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr)); //截取开始标识和结束标识之间的内容
var
splitFirst = prnhtml.split( "background=‘/Images/printTax.gif‘" ); //去掉打印中的背景图片
var
ResultString = splitFirst. join ( ‘‘ ); //组合被分割的页面
var
PrintWin = window.open( ‘about:blank‘ , ‘Print‘ , ‘height=1px,width=1px,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no,top=20px,left=20px‘ );
PrintWin.document.write(ResultString);
//PrintWin.document.all.WebBrowser.ExecWB(7, 1);//打印预览
PrintWin.document.all.WebBrowser.ExecWB(6, 6); //打印document.all.WebBrowser.ExecWB(45,1)
PrintWin.document.all.WebBrowser.ExecWB(45, 1);
alert( "090o9oi" );
// PrintWin.setTimeout("window.close()", 100);
PageSetup_Default(); //设置为原始值
}
function thisChose() {
window.parent.CloseDiv();
}
</script> |
html部分代码
1
2
3
4
5
6
7
8
9
10
|
<html> <head> <title></title>
</head> <body> <!--startprint-->
<%=pointlist%><!--需要打印的代码-->
<!--endprint-->
</body> </html> |