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.

Table and<br />

List Objects<br />

(Chapter 27)<br />

Dynamic object models that take advantage of automatic<br />

page reflow create huge opportunities for creative Web<br />

designers. Nowhere is that more apparent than in the TABLE<br />

element object and all the other objects that nest within (TR,<br />

TH, TD, and so on). Not only is it possible to swap the content<br />

of a table cell at any time, but the object models provide powerful<br />

methods for completely remolding the composition of a<br />

table on the fly.<br />

HTML tables are at once elegant because they provide a lot<br />

of pleasing organization to a page with little code, and also<br />

complex due to the large number of related elements and substantial<br />

list of attributes for each element. Those attributes<br />

become object properties in the modern object model, so it<br />

means that scripters have much to choose from (and be confused<br />

by) when bringing tables to life.<br />

Using the special-purpose methods that insert rows and<br />

cells also takes some initial adjustment for many scripters.<br />

For example, inserting a row has almost no visual effect on an<br />

existing table until you not only insert cells into the row, but<br />

also plant content in the cells. Code examples for these operations<br />

are part of the general discussion of the TABLE object in<br />

the <strong>JavaScript</strong> <strong>Bible</strong>.<br />

Designers whose browser targets are IE4+/Windows can<br />

also take advantage of Microsoft’s data binding technology.<br />

Data from external sources can fill tables with only the slightest<br />

bit of HTML markup. Chapter 15 contains examples of this<br />

in its discussion of the dataFld and related properties.<br />

This chapter also includes objects for ordered and<br />

unordered lists (and list items nested within). In concert with<br />

style sheets that can include or exclude elements from page<br />

rendering, these objects provide additional layout opportunities<br />

for clever designers.<br />

11<br />

C H A P T E R<br />

✦ ✦ ✦ ✦<br />

In This Chapter<br />

Modifying table cell<br />

content<br />

Adding and deleting<br />

table rows<br />

Modifying table<br />

dimensions, colors,<br />

and borders<br />

Changing numbering<br />

sequences and bullet<br />

symbols for LI element<br />

objects<br />

✦ ✦ ✦ ✦

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

Saved successfully!

Ooh no, something went wrong!