How to print via scripting
Printing via script is not possible in Netscape or Internet Explorer 3.
One feature that I have taken advantage of is that a subroutine can be accessed via the window obect window.functionname. This means we can name the printing subroutine print and if we call window.print( ) on the click of the print button, Netscape will call its built in print method, and Internet explorer will call our print routine. This little routine is written in VBScript so Netscape will ignore it. The catch will be: when Internet explorer starts to support the print method we will have to modify our code. We would probably have to change the code then any way to account for a new web browser object.
The final consideration is, what happens when the user cancels the print or there is some printing error, or their browser doesn't support printing? All we need to do is trap the errors, and check if there was one after issuing the print command.
Here is the code for a simple print page:
Check out the printing article on the Microsoft MSDN Workshop site that shows some alternatives, including a solution for printing frames.
My Tripod homepage : Comments and corrections welcome to firstname.lastname@example.org or my guestbook.