js打印功能
文章描述:
js打印功能
html
<a href="javascript:printme()" target="_self">打印</a>
script
var global_Html = "";
function printme() {
global_Html = document.body.innerHTML;
document.body.innerHTML = document.getElementById('divPrint').innerHTML;
window.print();
window.setTimeout(function () {
document.body.innerHTML = global_Html;
}, 1500);
}
发布时间:2022/05/07
发表评论