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.

144<br />

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

Figure 2-3: The main and subwindows, inextricably linked via the window.opener<br />

property<br />

Finally, the second window contains a text input object. Enter any text there that<br />

you like and either tab or click out of the field. The onChange event handler updates<br />

the field in the opener’s document (provided that document is still loaded).<br />

pageXOffset<br />

pageYOffset<br />

windowObject.pageXOffset<br />

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

Compatibility ✓ ✓<br />

Example<br />

The script in Listing 16-13 is an unusual construction that creates a frameset<br />

and creates the content for each of the two frames all within a single HTML document<br />

(see “Frame Object” in Chapter 16 of the <strong>JavaScript</strong> <strong>Bible</strong> for more details).<br />

The purpose of this example is to provide you with a playground to become familiar<br />

with the page offset concept and how the values of these properties correspond<br />

to physical activity in a scrollable document.<br />

In the left frame of the frameset are two fields that are ready to show the pixel<br />

values of the right frame’s pageXOffset and pageYOffset properties. The content

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

Saved successfully!

Ooh no, something went wrong!