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.

gColor<br />

Chapter 11 ✦ Table and List Objects (Chapter 27)<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 assign a color to the<br />

table. After looking at the table to see its initial state, enter the following IE5+/NN6+<br />

statement into the top text box:<br />

document.getElementById(“myTable”).bgColor = “lightgreen”<br />

When you look at the table again, you see that only some of the cells turned to<br />

green. This is because colors also are assigned to table elements nested inside the<br />

outermost table element, and the color specification closest to the actual element<br />

wins the contest.<br />

border<br />

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

Compatibility ✓ ✓ ✓ ✓<br />

Example<br />

To remove all traces of an outside border of a table (and, in some combinations<br />

of attributes of other table elements, borders between cells), use the following<br />

statement (in IE5+/NN6+ syntax):<br />

document.getElementById(“myTable”).border = 0<br />

borderColor<br />

borderColorDark<br />

borderColorLight<br />

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

Compatibility ✓ ✓ ✓<br />

Example<br />

Assuming that you have set the initial light and dark color attributes of a table,<br />

the following function swaps the light and dark colors to shift the light source to<br />

the opposite corner:<br />

383<br />

TABLE.borderColor

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

Saved successfully!

Ooh no, something went wrong!