Best viewed in 1024 X 800 resolution... Leave a comment if u like an article...
Google
 
Web tezcols.blogspot.com

Saturday, February 24, 2007

javascript to PRINT your webpage....

Many times programmers / web-designers need to print a receipt after a particular transaction... I have found many of them embedding ActiveX control for printing mechanism in their pages... activex control code looks awkward, class id is to be remembered, wil not wrk fine on all explorers....

here is a simple solution.... use
self.print() function in onclick method of a button which prints the page having the button...

The button will be hidden before printing in the code given below....

< html >
< body >

< form name='prnttest' >
this html prints the page... < br/ >< b >hides the button before printing < /br >

< table >
< tr >< td >
1< input type='radio' name='hh' value='1' >
< /td >< /tr >

< tr >< td >
2< input type='radio' name='hh' value='2' >
< /td >< /tr >
< tr >< td >
3< input type='radio' name='hh' value='3' >
< /td >< /tr >
< tr >< td >
4< input type='radio' name='hh' value='4' >
< /td >< /tr >
< /table >

< input type='button' value='Print' onclick="this.style.visibility='hidden';self.print();"/ >
< /form >
< /body >
< /html >

share ur experiences if this helps you....

tezcols

Labels:

0 Comments:

Post a Comment

<< Home