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.

Chapter 3 ✦ Location and History Objects (Chapter 17)<br />

history.back() and history.forward() for righthand frame:<br />

<br />

history.back() for this frame:<br />

history.back() for parent:<br />

<br />

<br />

<br />

<br />

go(relativeNumber | “URLOrTitleSubstring”)<br />

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

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

Example<br />

Fill in either the number or text field of the page in Listing 17-14 and then click<br />

the associated button. The script passes the appropriate kind of data to the go()<br />

method. Be sure to use negative numbers for visiting a page earlier in the history.<br />

Listing 17-14: Navigating to an Item in History<br />

<br />

<br />

history.go() Method<br />

<br />

function doGoNum(form) {<br />

window.history.go(parseInt(form.histNum.value))<br />

}<br />

function doGoTxt(form) {<br />

window.history.go(form.histWord.value)<br />

}<br />

<br />

<br />

<br />

<br />

Calling the history.go() method:<br />

<br />

Continued<br />

221<br />

windowObject.history.go()

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

Saved successfully!

Ooh no, something went wrong!