Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing 1

Status
Not open for further replies.

anastasia

Programmer
Dec 13, 2000
111
GB
Does anyone know the syntax that can be displayed in a print button so that the page which the user is on can be printed out to their printer?

Thanks
 
go to the javascript forum
click on "advanced search"
enter : "print" as a search keyword

there you goooooooo ! the answer is here !!
 
You can actually try on this into ur coding!
<input type=&quot;button&quot; value=&quot;Print&quot; onClick=&quot;window.print()&quot;>
 

<cfif #cgi.Http_User_Agent# does not contain 'compatible'>
<cfif #cgi.Http_User_Agent# contains 'Mozilla/4'>
<!--- Browser is Netscape --->
<body onload=&quot;window.print();&quot;></body>

<cfif #cgi.Http_User_Agent# contains 'MSIE'>
<cfif #cgi.Http_User_Agent# contains 'Mozilla/4'>
<!--- Browser is IE --->
<body onload=&quot;WebBrowser1.ExecWB(6,1)&quot;><OBJECT ID=&quot;WebBrowser1&quot; WIDTH=0 HEIGHT=0 CLASSID=&quot;CLSID:8856F961-340A-11D0-A96B-00C04FD705A2&quot;></OBJECT></body>

This code as is will print the page out when you load it.
You want to use the print code when responding to the click event on one of your form buttons: (onclick=&quot;put code here&quot;)
 
Thanks you everyone for your reply I have implemented the onClick=&quot;window.print()&quot;> which works fine.
 
Thank you everyone for your reply I have implemented the onClick=&quot;window.print()&quot;> which works fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top