Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
XML
var popup = window.open("PrintRecords.aspx");
      popup.document.open();
      popup.document.write("<html><head><link rel='Stylesheet' type='text/css' href='Css/Style.css' /></head><body class='background_style'>");
      popup.document.write(sHTMLTable);
      popup.document.write("</body></html>");
      popup.document.close();
      popup.focus();
      popup.print();
      popup.close();


If we click the button in one page, the above block will be called. then it opens a new window with print dialog. If i close the print dialog by using Close Icon(X) , next line is not called(popup.close()).

Why the next line not called?

Your answer will be appriciated.. Thanks..
Posted

1 solution

I have no idea why doing all that. There is more healthy approach to printing of Web document. You can use CSS @media rules. Please see:
http://www.w3.org/TR/CSS21/page.html[^].

This is like having "printable version", but in a civilized way. The styles detect what is the media for rendering and apply one or another set of rules.

—SA
 
Share this answer
 

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