使用window.open 打开一个和当前页一样内容的窗口。
var printPreview = window.open('',"_blank","status=0,toolbar=0,location=0,menubar=0,directories=0,scrollbars=1,resizable=1") var printDocument = printPreview.document; printDocument.open(); var html = document.documentElement.innerHTML; printDocument.write("<html>"+html +"</html>"); printDocument.close();