js实现局部打印,并处理浏览器提示Avoid using document.write()导致无法打印问题
//新建iframe
const iframe = document.createElement('IFRAME');
let doc = null;
//添加属性
iframe.setAttribute('style', 'position:absolute;width:0px;height:0px;left:-500px;top:-400px;');
//插入
document.body.appendChild(iframe)
doc = iframe.contentWindow.docu
原创
2021-08-12 11:54:51 ·
4509 阅读 ·
1 评论