Show how to print a table in a html page
| Table Title | |||||
| Row 1 - Column1 | Row 1 - Column2 | ||||
| Empty here |
| ||||
<script language="javascript">
function printTable(obj)
{
var winname = window.open('', "_blank", 'toolbar=no,menubar=yes,scrollbars=yes, resizable=yes,location=no, status=yes');
winname.document.open('text/html', 'replace');
winname.document.writeln(obj.outerHTML);
winname.document.close();
}
function printTableById(tableid)
{
var tb = document.getElementById(tableid);
if(tb == null)
alert('Can not found the table you want to print /n (table id is ' + tableid + ')');
else
printTable(tb);
document.close();
}
</script>
博客主要展示了在HTML页面中打印表格的方法,涉及HTML和JavaScript相关知识,帮助开发者解决在网页上打印表格的问题。
8288

被折叠的 条评论
为什么被折叠?



