第137天 用js实现页面局部打印和预览原理是什么呢?同时在IE上有什么不同?
Activity
bowencool commentedon Aug 31, 2019
以React为例封装一个PrintContainer
xiaotianxia commentedon Sep 2, 2019
这样吗
bowencool commentedon Sep 4, 2019
这样写的话.somedom的子元素也不见了吧?😰
xiaotianxia commentedon Sep 4, 2019
是哦 是我草率了:grin:
censek commentedon Feb 19, 2020
xiaoqiangz commentedon Jul 13, 2022
bdhtml=window.document.body.innerHTML;
sprnstr="";
eprnstr="";
prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
window.document.body.innerHTML=prnhtml;
window.print();
window.document.body.innerHTML = bdhtml;