jsp页面如何打印一个表格,代码是怎么样的?
展开全部
<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();
}
//-->
</script>
<a onClick="doPrint()"><img src="images/prn2.jpg" width="50" height="50" border="0"></a>
<!--startprint-->
<table width="700" align="left">
<tr><td>待打印的内容</td></tr>
</table>
<!--endprint-->
<!--
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();
}
//-->
</script>
<a onClick="doPrint()"><img src="images/prn2.jpg" width="50" height="50" border="0"></a>
<!--startprint-->
<table width="700" align="left">
<tr><td>待打印的内容</td></tr>
</table>
<!--endprint-->
追问
谢谢啦
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询