我在打印 div 内容时遇到问题。它正确打印它显示错误,如“sys”未定义..谁能告诉我解决方案,
<div id="mydiv" runat="server" style="display:none;">
</div>
我的javascript是:
function Print() {
var PrintDiv = $('#' + '<%= mydiv.ClientID %>').html();
//var NewWindow = window.open('', '', 'width=500,height=500');
var NewWindow = window.open('', '_blank', 'location=1,status=1,scrollbars=1,width=1000,height=700');
NewWindow.document.open("text/html");
NewWindow.document.write('<html><head><title></title>');
NewWindow.document.write('<link href="CSS/style.css" rel="stylesheet" type="text/css" />');
NewWindow.document.write('</head><body onload="window.print()">');
NewWindow.document.write(PrintDiv);
NewWindow.document.write('</body></html>');
NewWindow.document.close();
}