Printing


You also can print windows and frames using the print method like this: window .print() .

The print method opens the Print dialog box, prompting the user to change print settings and click OK to print. The Netscape Navigator 4.0 for Windows prints only the current frame. Netscape Navigator 6.0 enables you to print all frames if you use the print method from the <FRAMESET> window. Internet Explorer gives you the option of printing all frames or a specific frame.

Tip

When the user clicks the OK button in the Internet Explorer's Print dialog box, the following sequence of events occurs: The onbeforeprint event occurs, the document prints, and then the onafterprint event occurs. These events are not supported in the Netscape Navigator.


Here's an example that prints the current window:

(Listing 08-07.html on the web site)
 <HTML>      <HEAD>          <TITLE>              Printing a Window          </TITLE>          <SCRIPT LANGUAGE="JavaScript">              <!--  function printer()   {   window.print()   }  // -->          </SCRIPT>      </HEAD>      <BODY>          <H1>Printing a Window</H1>          <FORM>              <INPUT TYPE="BUTTON" ONCLICK="printer()" VALUE="Click Me!">          </FORM>      </BODY>  </HTML> 


Inside Javascript
Inside JavaScript
ISBN: 0735712859
EAN: 2147483647
Year: 2005
Pages: 492
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net