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.

206<br />

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

Location Object<br />

Properties<br />

hash<br />

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

Compatibility ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓<br />

Example<br />

When you load the script in Listing 17-1, adjust the size of the browser window so<br />

only one section is visible at a time. When you click a button, its script navigates to<br />

the next logical section in the progression and eventually takes you back to the top.<br />

Listing 17-1: A Document with Anchors<br />

<br />

<br />

location.hash Property<br />

<br />

function goNextAnchor(where) {<br />

window.location.hash = where<br />

}<br />

<br />

<br />

<br />

Top<br />

<br />

<br />

<br />

<br />

Section 1<br />

<br />

<br />

<br />

<br />

Section 2<br />

<br />

<br />

<br />

<br />

Section 3<br />

<br />

windowObject.location.hash

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

Saved successfully!

Ooh no, something went wrong!