我的代碼有什麼問題?我想將我的html表格導出爲pdf並保存。然後恰巧它只會打開空屏幕的新瀏覽器。這是我的示例代碼。請幫忙,謝謝。將html表導出爲pdf
<!DOCTYPE html>
<html>
</head>
<body>
<div id="pdf">
<table id="StudentInfoListTable">
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Track</th>
<th>S.S.C Roll</th>
<th>S.S.C Division</th>
<th>H.S.C Roll</th>
<th>H.S.C Division</th>
<th>District</th>
</tr>
</thead>
<tbody>
<tr>
<td>alimon </td>
<td>Email</td>
<td>1</td>
<td>2222</td>
<td>as</td>
<td>3333</td>
<td>dd</td>
<td>33</td>
</tr>
</tbody>
</table>
</div>
<!--<button >Submit</button> -->
<li> <a href="javascript:PrintDiv()">Export to pdf</a> </li>
<script type="text/javascript">
function PrintDiv(htmlexportPDF) {
var divToPrint = document.getElementById(htmlexportPDF);
alert('Printing: Success');
var popupWin = window.open('', '_blank', 'width=650,height=600');
popupWin.document.open();
popupWin.document.write('<style type="text/css">body{ margin:0.5px;');
popupWin.document.write('font-family:verdana,Arial;color:#000;');
popupWin.document.write('font-family:Verdana, Geneva, sans-serif; font-size:8px;}');
popupWin.document.write('a{color:#000;text-decoration:none;}</style>');
popupWin.document.write('<html><body onload="window.print()">' + divToPrint.innerHTML + '</html>');
popupWin.document.close();
}
</script>
謝謝。先生:)對不起,關閉