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 6 ✦ Image, Area, and Map Objects (Chapter 22)<br />

Example<br />

Use The Evaluator (Chapter 13 in <strong>JavaScript</strong> <strong>Bible</strong>) to experiment with the<br />

height and width properties. Begin retrieving the default values by entering the<br />

following two statements into the top text box:<br />

document.myIMG.height<br />

document.myIMG.width<br />

Increase the height of the image from its default 90 to 180:<br />

document.myIMG.height = 180<br />

If you scroll down to the image, you see that the image has scaled in proportion.<br />

Next, exaggerate the width:<br />

document.myIMG.width = 400<br />

View the resulting image.<br />

hspace<br />

vspace<br />

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

Compatibility ✓ ✓ ✓ ✓ ✓ ✓<br />

Example<br />

Use The Evaluator (Chapter 13 in <strong>JavaScript</strong> <strong>Bible</strong>) to experiment with the<br />

hspace and vspace properties. Begin by noticing that the image near the bottom of<br />

the page has no margins specified for it and is flush left with the page. Now assign a<br />

horizontal margin spacing of 30 pixels:<br />

document.myIMG.hspace = 30<br />

The image has shifted to the right by 30 pixels. An invisible margin also exists to<br />

the right of the image.<br />

isMap<br />

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

Compatibility ✓ ✓ ✓ ✓<br />

323<br />

IMG.isMap

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

Saved successfully!

Ooh no, something went wrong!