You are here:   Home > Scripts > Javascript Print webpage script
What's
New
Doll
Makers
Room
Makers
Puzzle
Makers
Roiworld Stardoll Links
GirlSense - online dress up games for girls with fashion sense

Back to Scripts

Tutorial, calling Print in HTML


Creating a simple Print button or link.

This is a client side request, this is a non-standard call and works only in IE 5 (and firefox) and above. However the flip side is that 97% of the browser market is using Internet Explorer or Firefox. The method call is very simple to execute

<a href="javascript:window.print()">Print this page</a>

Try it!
Print this page


Print child Window

If you are generating the content of the popup window on the fly (document.write) make sure to close the document window before printing, otherwise the print functionality will not work.
newWindow.document.close();


Hiding HTML elements before printing

Microsoft has an "onbeforeprint" and "onafterprint" events that you can listen on to hide sections of your screen, commonly layered using DIV's. And when the printing is done, to bring back those layers.


IE browser market (eLouai stats)

01 Mar 2004 - 19 Mar 2004, number of visitors
Internet Explorer53,64195.00%
Netscape7911.40%
Mozilla5350.95%
Mozilla Agent3630.64%
Safari(Apple)2290.41%
Opera1450.26%
Other...
Total56,474100%


UPDATE:
Browser Market Share for eLouai.com

01 Mar 2006 - 19 Mar 2006, number of visitors
Internet Explorer1,066,55887.00%
Firefox121,5509.91%
Safari15,4131.26%
Opera12,7941.04%
Netscape4,5390.37%
Mozilla4,2530.35%
Other...
Total1,225,994100%


references:
MSDN: print() Method
Faqts knowledge base: printing in a child window




About     Privacy Policy     Hosting by Web Hosting Canada

Except where otherwise noted, this site is licensed under a Creative Commons License



contact us: elouai@gmail.com
©2003-2008 eLouai.com, All rights reserved