js调用打印机
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <input id="btnPrint" value="打印" type="button" onclick="preview()";/> <!--startprint--> <table border="1" cellspacing="0" cellpadding="0"> <tr> <td>111111</td> <td>222222</td> </tr> <tr> <td>111111</td> <td>222222</td> </tr> <tr> <td>111111</td> <td>222222</td> </tr> </table> <!--endprint--> </body> </html> <script type="text/javascript">function preview()
{
bdhtml=window.document.body.innerHTML;
//<!--startprint-->开始标志
sprnstr="<!--startprint-->";
// <!--endprint-->结束标志
eprnstr="<!--endprint-->";
prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+17);
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
window.document.body.innerHTML=prnhtml;
window.print();
} </script>