调用windows打印机

来源:互联网 发布:linux中ping命令 编辑:程序博客网 时间:2024/06/05 23:56
<head>  
<script language="JavaScript">  
<!--  
function doPrint() {  
bdhtml = window.document.body.innerHTML;  
sprnstr = "<!--startprint-->";  
eprnstr = "<!--endprint-->";  
prnhtml = bdhtml.substr(bdhtml.indexOf(sprnstr) + 17);  
prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));  
window.document.body.innerHTML = prnhtml;  
window.print();  
location.reload();  
}  
//-->  
</script>  
</head>  
  
<body>  
    <!--startprint-->  
<table width="700" align="left" border="1">  
<tr>  
<td>待打印的内容</td>  
</tr>  
</table>  
<!--endprint-->  
<input type="button" onclick="doPrint()">  
</body>