The TR Element


The <TR> Element

You create rows in tables with the <TR> element; you can see an overview of the properties and methods of this element in Table 14.11, its properties in depth in Table 14.12, and its methods in Table 14.13. Remember that JavaScript's core HTML properties, methods, and events, which we covered in Chapters 5 and 6, apply to the <TR> element as well.

Table 14.11. Overview of the Properties and Methods of the <TR> Element (See Chapters 5 and 6 for the JavaScript core HTML properties, methods, and events that also apply to this element.)

Properties

Methods

align

deleteCell

bgColor

insertCell

borderColor

 

borderColorDark

 

borderColorLight

 

cells

 

ch

 

chOff

 

height

 

rowIndex

 

sectionRowIndex

 

vAlign

 
Table 14.12. The Properties of the <TR> Element (See Chapters 5 and 6 for the JavaScript core HTML properties, methods, and events that also apply to this element.)

Property

NS2

NS3

NS4

NS6

IE3a

IE3b

IE4

IE5

IE5.5

IE6

align

     

x

   

x

x

x

x

 

Read/write

 

Sets or gets the alignment of the row relative to the table. Set to "center" (aligns to the center), "justify" (aligns to the left and right edge), "left" (the defaultaligns to the left edge), or "right" (aligns to the right edge).

bgColor

     

x

   

x

x

x

x

 

Read/write

 

Sets or gets the background color for the table row. Set to a color triplet (such as "ffffff" ) or a predefined color the browser understands (such as " magenta " ).

borderColor

           

x

x

x

x

 

Read/write

 

Sets or gets the border color. Set to a color triplet (such as "ffffff" ) or a predefined color the browser understands (such as "coral" ).

borderColorDark

           

x

x

x

x

 

Read/write

 

Holds a color used for shading effects to make the table look "raised." Set to a color triplet (such as "ffffff" ) or a predefined color the browser understands (such as "cyan" ).

borderColorLight

           

x

x

x

x

 

Read/write

 

Holds a color used for shading effects to make the table look "raised." Set to a color triplet (such as "ffffff" ) or a predefined color the browser understands (such as "paleblue" ).

cells

     

x

     

x

x

x

 

Read-only

 

Holds a collection of all cells in the row (that is, all <TD> and <TH> elements). This property enables you to address each cell individually.

ch

     

x

         

x

 

Read/write

 

Corresponds to the CHAR attribute in <TR> elements, but doesn't actually do anything in either browser yet.

chOff

     

x

         

x

 

Read/write

 

Corresponds to the CHAROFF attribute in <TR> elements, but doesn't actually do anything in either browser yet.

height

           

x

x

x

x

 

Read/write

 

The height of the row, measured in pixels. Set to an integer value.

rowIndex

     

x

   

x

x

x

x

 

Read-only

 

Holds the position of the row in the rows collection. Set to an integer.

sectionRowIndex

     

x

   

x

x

x

x

 

Read-only

 

Holds the position of the object in the < TBODY > , <THEAD> , <TFOOT> elements, or rows collection as an integer.

vAlign

     

x

   

x

x

x

x

 

Read/write

 

Sets or gets how row contents are aligned within the row that contains them. Set to "middle" (the defaultaligns the text in the middle), "baseline" (aligns the base line of the first line of text with the base lines in adjacent objects), "bottom" (aligns the text at the bottom of the row), or "top" (aligns the text at the top of the row).

Table 14.13. The Methods of the <TR> Element (See Chapters 5 and 6 for the JavaScript core HTML properties, methods, and events that also apply to this element.)

Method

NS2

NS3

NS4

NS6

IE3a

IE3b

IE4

IE5

IE5.5

IE6

deleteCell

     

x

   

x

x

x

x

 

Returns: Nothing

 

Deletes a cell.

 

Syntax: tr .deleteCell([ index ]) , where index is the index of the cell in the cells collection. If index is omitted, this method deletes the last cell in the cells collection.

insertCell

     

x

   

x

x

x

x

 

Returns: New cell

 

Inserts a cell.

 

Syntax: tr .insertCell([ index ]) , where index is the index of the cell to insert in the cells collection. If index is omitted, this method inserts a new cell at the end of the cells collection.



Inside Javascript
Inside JavaScript
ISBN: 0735712859
EAN: 2147483647
Year: 2005
Pages: 492
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net