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.

318<br />

IMG.align<br />

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

Image and IMG Element Objects<br />

Properties<br />

align<br />

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

Compatibility ✓ ✓ ✓ ✓<br />

Example<br />

Listing 22-1 enables you to choose from the different align property values as<br />

they influence the layout of an image whose HTML is embedded inline with some<br />

other text. Resize the window to see different perspectives on word-wrapping on a<br />

page and their effects on the alignment choices. Not all browsers provide distinctive<br />

alignments for each choice, so experiment in multiple supported browsers.<br />

Listing 22-1: Testing an Image’s align Property<br />

<br />

<br />

IMG align Property<br />

<br />

function setAlignment(sel) {<br />

document.myIMG.align = sel.options[sel.selectedIndex].text<br />

}<br />

<br />

<br />

<br />

IMG align Property<br />

<br />

<br />

Choose the image alignment:<br />

<br />

absbottom<br />

absmiddle<br />

baseline<br />

bottom<br />

left<br />

middle<br />

right<br />

texttop<br />

top<br />

<br />

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

Saved successfully!

Ooh no, something went wrong!