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.

388<br />

TABLE.rules<br />

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

rules<br />

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

Compatibility ✓ ✓ ✓ ✓<br />

Example<br />

Listing 27-5 presents a page that cycles through all possible settings for the<br />

rules property. The rules property value is displayed in the table’s caption. When<br />

you run this script, notice the nice border display for this table’s combination of<br />

COLGROUP and table row segment elements. Figure 11-1 shows the IE/Windows<br />

rendition for the groups type of table rules. Early versions of NN6 may not render<br />

the altered table correctly, and scripted changes won’t appear on the page.<br />

Listing 27-5: Cycling Through Table rules Property Values<br />

<br />

<br />

TABLE.rules Property<br />

<br />

var timeoutID<br />

var rulesValues = [“all”, “cols”, “groups”, “none”, “rows”]<br />

function rotateBorder(i) {<br />

document.getElementById(“myTABLE”).rules = rulesValues[i]<br />

document.getElementById(“myCAPTION”).innerHTML = rulesValues[i]<br />

i = (++i == rulesValues.length) ? 0 : i<br />

timeoutID = setTimeout(“rotateBorder(“ + i + “)”, 2000)<br />

}<br />

function stopRotate() {<br />

clearTimeout(timeoutID)<br />

document.getElementById(“myTABLE”).rules = “all”<br />

document.getElementById(“myCAPTION”).innerHTML = “all”<br />

}<br />

<br />

<br />

<br />

TABLE.rules Property<br />

<br />

<br />

<br />

Cycle Table Rule Visibility<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

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

Saved successfully!

Ooh no, something went wrong!