15.02.2013 Views

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 2 ✦ Window and Frame Objects (Chapter 16)<br />

<br />

<br />

<br />

<br />

If you need to create a new window for the lowest common denominator of<br />

scriptable browser, you will have to omit the focus() method and the<br />

window.closed property from the script (as well as add the NN2 bug workaround<br />

described earlier). Or you may prefer to forego a subwindow for all browsers below<br />

a certain level. See Listing 16-3 (in the window.closed property discussion) for<br />

other ideas about cross-browser authoring for subwindows.<br />

print()<br />

NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5<br />

Compatibility ✓ ✓ ✓ ✓<br />

Example<br />

Listing 16-27 is a frameset that loads Listing 16-28 into the top frame and a copy<br />

of the Bill of Rights into the bottom frame.<br />

Listing 16-27: Print Frameset<br />

<br />

<br />

window.print() method<br />

<br />

<br />

<br />

<br />

<br />

<br />

Two buttons in the top control panel (Listing 16-28) let you print the whole<br />

frameset (in those browsers and OSs that support it) or just the lower frame. To<br />

print the entire frameset, the reference includes the parent window; to print the<br />

lower frame, the reference is directed at the parent.display frame.<br />

165<br />

windowObject.print()

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!