no border on HTML table when printing

前端 未结 6 1866
感情败类
感情败类 2020-12-14 19:21

I\'m working on website that is supposed to print table.

One problem I\'m running into is that some table borders won\'t be printed, although they are correctly disp

6条回答
  •  [愿得一人]
    2020-12-14 20:14

    Try this, replace YOUR.css with your link:

    function printDiv() {
    var strHtml = "\n\n \n
    \n" + document.getElementById('table').innerHTML + "\n
    \n\n"; newWin = window.open(""); newWin.document.writeln(strHtml); newWin.print(); newWin.close(); } document.getElementById('printbtn').addEventListener('click', printDiv);

提交回复
热议问题