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.

start<br />

x<br />

y<br />

Chapter 6 ✦ Image, Area, and Map Objects (Chapter 22)<br />

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

Compatibility ✓ ✓ ✓<br />

Example<br />

See Listing 22-3 earlier in this chapter for an example of how you can use the<br />

start property with a page that loads a movie clip into an IMG element object.<br />

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

Compatibility ✓<br />

Example<br />

If you want to scroll the document so that the link is a few pixels below the top of<br />

the window, use a statement such as this:<br />

window.scrollTo(document.images[0].x, (document.images[0].y - 3))<br />

Event handlers<br />

onAbort<br />

onError<br />

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

Compatibility ✓ ✓ ✓ ✓ ✓ ✓<br />

Example<br />

Listing 22-5 includes an onAbort event handler. If the images already exist in the<br />

cache, you must quit and relaunch the browser to try to stop the image from loading.<br />

In that example, I provide a reload option for the entire page. How you handle<br />

the exception depends a great deal on your page design. Do your best to smooth<br />

over any difficulties that users may encounter.<br />

329<br />

IMG.onAbort

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

Saved successfully!

Ooh no, something went wrong!