html 代码 printLink(){ var el = document.getElementById("printEventName"); var iframe = document.createElement('IFRAME'); var doc = null; iframe.setAttribute('style', 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;'); document.body.appendChild(iframe); doc = iframe.contentWindow.document; doc.write('<style type="text/css"></style><div>' + el.innerHTML + '</div>'); doc.close(); iframe.contentWindow.focus(); iframe.contentWindow.print(); if (navigator.userAgent.indexOf("MSIE") > 0){document.body.removeChild(iframe);} }
评论 (0 )
最新评论
暂无评论
赶紧努力消灭 0 回复