最佳答案
根据 print html through javascript / jquery你可以使用这段代码:
function Print() {
var docprint = window.open("about:blank", "_blank");//new page
var oTable = document.getElementById("result_tbl").rows.item(0); //get the 1st row by a selector
docprint.document.open();
docprint.document.write('<html><head><title>Ashley Mattresses</title>'); //write HEAD section
docprint.document.write('</head><body><center>'); //write BODY tag and center tag for printing
docprint.document.write(oTable.innerHTML); //select the TR's HTML and add it to the new page
docprint.document.write('</center></body></html>'); //close BODY tag
docprint.document.close();
docprint.print();
docprint.close();
}
关于javascript - 如何使用 window.print 在我的结果中打印单行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34530386/