如何用表格框架打印html表格 [英] how to print html table with the table frame
本文介绍了如何用表格框架打印html表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用过;
I used;
function Print()
{
var divToPrint = document.getElementById('grid');
newWin = window.open("");
newWin.document.write(divToPrint.outerHTML);
newWin.print();
newWin.close();
}`
但这个代码片段打印只能获取表中的数据..我想要所有表打印...
but this code snippet print only get data in the table..I want to all table print...
推荐答案
使用此代码..
Use this code..
<script>
function myFunction() {
//window.print();
var panel = document.getElementById("<%=pnlContents.ClientID %>");//put your table inside a panel.
var printWindow = window.open('', '', 'height=800,width=800');
printWindow.document.write('<html><head><title>DIV Contents</title>');
printWindow.document.write('</head><body >');
printWindow.document.write(panel.innerHTML);
printWindow.document.write('</body></html>');
printWindow.document.close();
setTimeout
(function () {
printWindow.print();
}, 500);
return false;
}
</script>
问题解决了...我忘了带边框的桌子..thx
problem solved...I forgot table with border..thx
这篇关于如何用表格框架打印html表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文