标签:
1 function doPrint() { 2 setTimeout(function() { 3 bdhtml=window.document.body.innerHTML; 4 sprnstr="<!--startprint-->"; 5 eprnstr="<!--endprint-->"; 6 7 prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17); 8 prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); 9 OpenWindow = window.open(""); 10 OpenWindow.document.write("<!DOCTYPE HTML><HTML><HEAD><meta http-equiv=\"Content-Type\" content=\"text\/html; charset=utf-8\" \/><TITLE>打印页<\/TITLE><link href=\"css\/com.css\" rel=\"stylesheet\" type=\"text\/css\" \/><\/HEAD><BODY><div id=\"printbox\" ><\/div><\/BODY><\/HTML>"); 11 OpenWindow.document.getElementById("printbox").innerHTML=prnhtml; 12 13 OpenWindow.document.close(); 14 OpenWindow.print(); 15 16 }, 200);
标签:
原文地址:http://www.cnblogs.com/xxxxzy/p/4599645.html