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.

382<br />

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

<strong>Examples</strong> Highlights<br />

✦ Scripts can adjust the value of a TABLE object’s width property, including<br />

switching between a fixed pixel size and a percentage of the table container’s<br />

width.<br />

✦ Compare the examples for the IE5/Windows TABLE.cells property and the<br />

TR.cells property for IE4+ and NN6.<br />

✦ Follow the example for the TD.colSpan property to observe how a table<br />

responds to such changes in real time.<br />

✦ <strong>Examples</strong> for list-related elements show how to set the list types for scriptgenerated<br />

lists.<br />

TABLE Element Object<br />

TABLE.background<br />

Properties<br />

align<br />

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

Compatibility ✓ ✓ ✓ ✓<br />

Example<br />

Use The Evaluator (Chapter 13 in the <strong>JavaScript</strong> <strong>Bible</strong>) to see the align property<br />

at work. The default value (left) is in force when the page loads. But you can shift<br />

the table to right-align with the body by entering the following statement into the<br />

top text box for IE5+ and NN6+:<br />

document.getElementById(“myTable”).align = “right”<br />

background<br />

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

Compatibility ✓ ✓ ✓<br />

Example<br />

Treat the background property of a table like you do the src property of an IMG<br />

element object. If you precache an image, you can assign the src property of the<br />

precached image object to the background property of the table for quick image<br />

changing. Such an assignment statement looks like the following:<br />

document.all.myTable.background = imgArray[“myTableAlternate”].src

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

Saved successfully!

Ooh no, something went wrong!