1.調用window本地方法進行打印
function Print(){
//取出需要打印的頁面html
var printStr = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'><title>Print</title></head><body>";var content = "";
//如果需要分頁,請設置樣式page-break-after:always,意思是從下一行開始分割。
content = content + str;
printStr = printStr+content+"</body></html>";
//打開新頁面,並且將需要打印的內容寫入
var pwin=window.open("TA.htm","print");pwin.document.write(printStr);
pwin.document.close();
//打印
pwin.print();
//關閉瀏覽器
pwin.close();}