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.

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

reloads the document as if you had clicked the browser’s Reload/Refresh button. It<br />

also preserves the visible properties of form elements. The Hard Reload button<br />

invokes the location.reload() method, which resets all objects to their default<br />

settings.<br />

Listing 17-9: Hard versus Soft Reloading<br />

<br />

<br />

Reload Comparisons<br />

<br />

function hardReload() {<br />

location.reload(true)<br />

}<br />

function softReload() {<br />

history.go(0)<br />

}<br />

<br />

<br />

<br />

<br />

Radio 1<br />

Radio 2<br />

Radio 3<br />

<br />

<br />

Red<br />

Green<br />

Blue<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

replace(“URL”)<br />

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

Compatibility ✓ ✓ ✓ ✓ ✓ ✓<br />

Example<br />

Calling the location.replace() method navigates to another URL similarly to<br />

assigning a URL to the location. The difference is that the document doing the calling<br />

217<br />

windowObject.location.replace()

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

Saved successfully!

Ooh no, something went wrong!