Click here to Skip to main content
15,894,896 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi experts,

Am trying to do print preview using javascript in my asp .net application.
my javascript is like this.

function PrintPanel()
{
var panel = document.getElementById("<%=div_print.ClientID %>");
var printWindow = window.open('', '', 'height=800,width=800');

printWindow.document.write('<html><head><title></title>');
printWindow.document.write('</head><body >');
printWindow.document.write(panel.innerHTML);
printWindow.document.write('</body></html>');
printWindow.document.close();

printWindow.document.close();
setTimeout(function() {
printWindow.focus();
printWindow.print();

}, 500);
return false;
}

--------------------------
but in IE11 am getting a error like

JavaScript runtime error: Unable to get property 'document' of undefined or null reference
in other browsers its working fine.

can any one please help me solve this issue.???
thanks in advance
(Keerthi Kumar)
Posted
Comments
Vi(ky 4-Jul-14 1:50am    
try window.print();

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900