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.

218<br />

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

doesn’t appear in the history list after the new document loads. Check the history<br />

listing (in your browser’s usual spot for this information) before and after clicking<br />

Replace Me in Listing 17-10.<br />

Listing 17-10: Invoking the location.replace() Method<br />

<br />

<br />

location.replace() Method<br />

<br />

function doReplace() {<br />

location.replace(“lst17-01.htm”)<br />

}<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

History Object<br />

Properties<br />

length<br />

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

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

Example<br />

The simple function in Listing 17-11 displays one of two alert messages based on<br />

the number of items in the browser’s history.<br />

Listing 17-11: A Browser History Count<br />

<br />

<br />

History Object<br />

<br />

windowObject.history.length

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

Saved successfully!

Ooh no, something went wrong!