function printView() {
var newWin = window.open('printer', '', '');
var titleHTML = document.getElementById("printdiv").innerHTML;
newWin.document.write(titleHTML);
newWin.document.location.reload();
newWin.print();
newWin.close();
}get
把须要打印的内容放在一个div里面 点击按钮时 会先把打印的内容提交到一个新的页面 it