js打印表格内容
来源:互联网 发布:青少年儿童 vb可以吃 编辑:程序博客网 时间:2024/05/19 17:25
function printTable()
{
bdhtml=window.document.body.innerHTML;
sprnstr="<!--startprint-->";//必须在页面添加<!--startprint-->和<!--endprint-->而且需要打印的内容必须在它们之间
eprnstr="<!--endprint-->";
prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
var newwin = window.open("");
var css="<style>table{width: 100%; text-align: left; border-collapse: collapse; background: #fff; font: 16px '微软雅黑'; color:#333;}"
+"table tr{height: 60px;}"
+"table tr:first-child{height: 46px;}"
+"table tr:nth-child(2n+1){background-color: #eef3f9;}"
+"table tr:hover{background: #1099c0; color: #fff;}"
+"table th{-height: 46px; color: #fff; background-color: #1099c0;text-align: left;}"
+"table th:first-child{width: 5%;}"
+"table td{height: 60px;} "
+"table td:last-child{color: #1bcd94;}"
+"table td.notEnabled{color: #ff6d46;}"
+"table div{width: 16px; height: 16px; border: 1px solid #959595; margin: 0 auto; background: #fff;}"
+"table div.current{background: url(../img/gou2.png) center no-repeat #fff;}</style>"
newwin.document.body.innerHTML=css+prnhtml;
newwin.print();
}
{
bdhtml=window.document.body.innerHTML;
sprnstr="<!--startprint-->";//必须在页面添加<!--startprint-->和<!--endprint-->而且需要打印的内容必须在它们之间
eprnstr="<!--endprint-->";
prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
var newwin = window.open("");
var css="<style>table{width: 100%; text-align: left; border-collapse: collapse; background: #fff; font: 16px '微软雅黑'; color:#333;}"
+"table tr{height: 60px;}"
+"table tr:first-child{height: 46px;}"
+"table tr:nth-child(2n+1){background-color: #eef3f9;}"
+"table tr:hover{background: #1099c0; color: #fff;}"
+"table th{-height: 46px; color: #fff; background-color: #1099c0;text-align: left;}"
+"table th:first-child{width: 5%;}"
+"table td{height: 60px;} "
+"table td:last-child{color: #1bcd94;}"
+"table td.notEnabled{color: #ff6d46;}"
+"table div{width: 16px; height: 16px; border: 1px solid #959595; margin: 0 auto; background: #fff;}"
+"table div.current{background: url(../img/gou2.png) center no-repeat #fff;}</style>"
newwin.document.body.innerHTML=css+prnhtml;
newwin.print();
}
阅读全文
0 0
- js打印表格内容
- js如何打印表格
- JS打印指定内容
- JS打印页面内容
- 【转】js打印表格打印预览
- js中表格内容排序
- js读取表格单元格内容
- JS动态修改表格内容
- JS打印打印制定区域内容
- JS实现打印网页内容
- js 打印页面局部内容
- JS打印指定内容(新窗口)
- Js打印页面指定内容
- JS打印指定区域内容
- JS打印指定区域内容
- js打印页面指定内容
- 前端js实现打印excel表格
- js源码--表格内容的拖动
- 有个计算机大神的男朋友是个什么感觉?
- 知乎水军再探测
- 脑洞大开的工具
- 世界难题:他到底爱不爱我?
- 计算机系的你,毕业论文写了什么?
- js打印表格内容
- 可以把兴趣变成工作吗?
- 「新功能」知乎排名上线,快来查看你的知乎排名
- 紧急通知,高校同学请注意!
- 拒绝只是为了更好的成长
- 咪蒙让你休学你就休学?
- @所有人:别玩王者荣耀了!
- 我是怎么学Python 的?
- 我数据分析的套路