275Chapter 16 .Window (How to cite a web site) and Frame Objects print() Returns:
Sunday, December 30th, 2007275Chapter 16 .Window and Frame Objects print() Returns: Nothing. NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility . . The print() method provides a scripted way of sending the window or a frame from a frameset to the printer. In all cases, the Print dialog box appears for the user to make the typical printer choices when printing manually. This prevents a rogue print() command from tying up a printer without the user s permission. The precise behavior of the print()method varies a bit with the different ways NN and IE (not to mention operating systems) handle printing. In NN4+ (except for the Windows OS), you can print all frames of a frameset in one print()command when it is invoked for the framesetting (parent) document. NN4 for Windows, however, does not print the entire frameset at once. You can write a script that iterates through all frames and prints them with delays to let the content be sent to the print spooler: function printFrames(n) { parent.frames[n++].print() if (n < parent.frames.length) { setTimeout( printFrames( + n + ) ,5000) } } Invoke this function as printFrames(0), and the function does the rest. In IE5, the print dialog box gives the user the choice of printing just one frame or all of the frames. Make sure that the print()method is invoked for the desired frame when you want only that frame to print. The browser defaults to printing just that frame. IE5 introduces some print-specific event handlers that are triggered by scripted printing as well as manual printing. The events begin to fire after the user has accepted the Print dialog box. An onBeforePrint event handler can be used to show content that might be hidden from view but should appear in the printout. After the content has been sent to the print spooler, the onAfterPrint event can restore the page. On the CD-ROM Example (with Listings 16-27 and 16-28) on the CD-ROM NN4 printing anomalies The Windows and Unix versions of NN4 handle printing in a way that can cause the page to not print what the user sees because before the page prints, it is loaded into a hidden window. Any immediate scripts in the page run again, but any user- induced, scripted content modifications will most likely not be a part of the page. windowObject.print()
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.