Javascript on a Form to Print a Document

Mindwatering Incorporated

Author: Tripp W Black

Created: 10/17/2000 at 04:10 PM


Notes Developer Tips
Forms/Subforms, JavaScript

If you are designing forms for browsers and including frames, you may wish to add a button that the user can click on to print the current frame.

The following piece of code allows you to do this by simulating the Netscape or Internet Explorer function to print the selected frame:

For Domino you would create an action hotspot, choose javascript as type, and enter:
self.print(); return false

Naturally you could replace the text with a graphic. This function only works with Netscape Communicator 4.0 and Internet Explorer 4.0 onwards.

Another option is to use the window.print method. This method prints the window which in a frames format would print more than the customer might be expecting.

<a href="#" onClick="window.print();return false">

For Domino, create an action hotspot, choose javascript as the action code event type and type the following:
window.print(); return false

previous page