15.02.2013 Views

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

148<br />

<strong>JavaScript</strong> <strong>Examples</strong> <strong>Bible</strong>: The Essential Companion to <strong>JavaScript</strong> <strong>Bible</strong><br />

A couple other fine points are worth highlighting. First, the name of the framesetting<br />

window is set as Listing 16-14 loads, rather than in response to an onLoad<br />

event handler in the tag. The reason for this is that the name must be<br />

set in time for the documents loading in the frames to get that value. If I had waited<br />

until the frameset’s onLoad event handler, the name wouldn’t be set until after the<br />

frame documents had loaded. Second, I restore the parent window’s name to an<br />

empty string when the framesetting document unloads. This is to prevent future<br />

pages from getting confused about the window name.<br />

returnValue<br />

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

Compatibility ✓ ✓ ✓<br />

Example<br />

See Listing 16-39 for the showModalDialog() method for an example of how to<br />

get data back from a dialog box in IE4+.<br />

screenLeft<br />

screenTop<br />

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

Compatibility ✓ ✓<br />

Example<br />

Use The Evaluator (Chapter 13 in the <strong>JavaScript</strong> <strong>Bible</strong>) to experiment with the<br />

screenLeft and screenTop properties. Start with the browser window maximized<br />

(if you are using Windows). Enter the following property name into the top text box:<br />

window.screenLeft<br />

Click the Evaluate button to see the current setting. Unmaximize the window and<br />

drag it around the screen. Each time you finish dragging, click the Evaluate button<br />

again to see the current value. Do the same for window.screenTop.<br />

screenX<br />

screenY<br />

windowObject.screenX<br />

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

Compatibility ✓

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

Saved successfully!

Ooh no, something went wrong!