tr | NN 6 IE 4 DOM 1 | |||||||||||
The tr object reflects the tr element. Due to incomplete implementation, IE 4 for the Macintosh does not offer complete scripted access to these element objects. |
||||||||||||
HTML Equivalent | ||||||||||||
<tr> |
||||||||||||
Object Model Reference | ||||||||||||
[window.]document.getElementById("elementID") [window.]document.getElementById("tableID").rows[i] |
||||||||||||
Object-Specific Properties | ||||||||||||
|
||||||||||||
Object-Specific Methods | ||||||||||||
|
||||||||||||
Object-Specific Event Handler Properties | ||||||||||||
None. |
align | NN 6 IE 4 DOM 1 |
Read/Write | |
Defines the horizontal alignment of content within all cells of the row. |
|
Example | |
document.getElementById("myTR").align = "center"; |
|
Value | |
Any of the three horizontal alignment constants: center | left | right. |
|
Default | |
left |
bgColor | NN 6 IE 4 DOM 1 |
Read/Write | |
Specifies the background color of the table cells in the current row. This color setting is not reflected in the style sheet backgroundColor property. Even if the bgcolor attribute or bgColor property is set with a plain-language color name, the returned value is always a hexadecimal triplet. |
|
Example | |
document.getElementById("myTR").bgColor = "yellow"; |
|
Value | |
A hexadecimal triplet or plain-language color name. See Appendix A for acceptable plain-language color names. |
|
Default | |
Varies with browser and operating system. |
blur( ) | NN 2 IE 3 DOM 1 |
Removes focus from the current object, at which time the object's onblur event fires. Note that the range of elements capable of focus and blur (both the event and method) is limited in all browsers except for more recent versions of IE (see the shared tabindex attribute in Chapter 8). Most reliably for backward compatibility, apply the blur( ) method to blatantly focusable elements, such as text input and textarea elements. Assigning the attribute onfocus="this.blur( );" to a text input element, for instance, is a crude but effective backward-compatible way to largely disable a field for browsers that do not provide genuine element disabling. |
|
Use blur( ) and focus( ) methods in moderation on the same page. You can inadvertently trigger endless loops of blurring and focusing if alert dialog boxes are involved along the way. Moreover, be aware that when you invoke the blur( ) method on one object, some other object (perhaps the window object) receives an onfocus event. |
|
Parameters | |
None. |
|
Returned Value | |
None. |
borderColor | NN n/a IE 4 DOM n/a |
Read/Write | |
Specifies the color of the element's border. Internet Explorer applies the color to all four lines that make up the interior border of a cell. Therefore, colors of adjacent cells do not collide. |
|
Example | |
document.getElementById("myTR").borderColor = "salmon"; |
|
Value | |
A hexadecimal triplet or plain-language color name. A setting of empty is interpreted as "#000000" (black). See Appendix A for acceptable plain-language color names. |
|
Default | |
Varies with operating system. |
borderColorDark, borderColorLight | NN n/a IE 4 DOM n/a |
Read/Write | |
The 3-D effect of table borders in Internet Explorer is created by careful positioning of light and dark lines around the page's background or default color. You can independently control the colors used for the dark and light lines by assigning values to the borderColorDark (left and top edges of the cell) and borderColorLight (right and bottom edges) properties. |
|
Typically, you should assign complementary colors to the pair of properties. There is also no rule that says you must assign a dark color to borderColorDark. The attributes merely control a well-defined set of lines so you can predict which lines of the border change with each attribute. |
|
Example | |
document.getElementById("myTR").borderColorDark = "blue"; document.getElementById("myTR").borderColorLight = "cornflowerblue"; |
|
Value | |
A hexadecimal triplet or plain-language color name. A setting of empty is interpreted as "#000000" (black). See Appendix A for acceptable plain-language color names. |
|
Default | |
Varies with operating system. |
cells[ ] | NN 6 IE 4 DOM 1 |
Read-only | |
Returns a collection of td or th elements nested inside the table row. Items in the collection are in source code order. |
|
Example | |
var allRowCells = document.getElementById("myTR").cells; |
|
Value | |
Reference to a cells collection object. |
|
Default | |
Array of zero length. |
ch | NN 6 IE 5(Mac)/6(Win) DOM 1 |
Read/Write | |
Defines the text character used as an alignment point for text cells of the row. This property is normally of value only for the align attribute set to "char". In practice, neither IE nor Navigator responds to these properties. |
|
Example | |
document.getElementById("myTR").ch = "."; |
|
Value | |
Single character string. |
|
Default | |
None. |
chOff | NN 6 IE 5(Mac)/6(Win) DOM 1 |
Read/Write | |
Defines the offset point at which the character specified by the char attribute is to appear within a cell. In practice, neither IE nor Navigator responds to these properties. |
|
Example | |
document.getElementById("myTR").chOff = "80%"; |
|
Value | |
String value of the number of pixels or percentage (within the cell). |
|
Default | |
None. |
clientHeight, clientWidth | NN 7 IE 4 DOM n/a |
Read-only | |
Broadly speaking, these provide the height and width of the element's content, but with minor variations with respect to element padding among various operating system versions of IE and compatibility modes controlled by the DOCTYPE declaration. Not available for all element types in IE for Macintosh. For Netscape 7, values are zero except when an element's content overflows the viewable area, in which case the values reveal the dimensions of the viewable area (e.g., the browser window's content region for the document.body element). See the Section 9.2 at the beginning of this chapter for details. |
|
Example | |
var midHeight = document.body.clientHeight/2; |
|
Value | |
Integer pixel value. |
|
Default | |
0 |
focus( ) | NN 2 IE 3 DOM 1 |
Gives focus from the current object, at which time the object's onfocus event fires. Note that the range of elements capable of focus and blur (both the event and method) is limited in all browsers except for more recent versions of IE (see the shared tabindex attribute in Chapter 8). Most reliably for backward compatibility, apply the focus( ) method to blatantly focusable elements, such as text input and textarea elements. |
|
To give a text box focus and pre-select all the text in the box, use the sequence of focus( ) and select( ) methods on the element. If this sequence is to occur after windows change (such as after an alert dialog box closes), place the methods in a separate function, and invoke this function through the setTimeout( ) method following the alert( ) method for the dialog. This allows IE/Windows to sequence statement execution correctly. |
|
Parameters | |
None. |
|
Returned Value | |
None. |
height | NN n/a IE 5 DOM n/a |
Read/Write | |
Specifies the pixel or percentage height of the row. To change the height of a row dynamically, adjust the element's style.height value rather than the height property. |
|
Value | |
String value of the number of pixels or percentage (within the row). |
|
Default | |
None. |
rowIndex | NN 6 IE 4 DOM 1 |
Read-only | |
Returns a zero-based integer representing the position of the current row among all other tr elements in the entire table. The count is based on the source code order of the tr elements. |
|
Example | |
var whichRow = document.getElementById("myTR").rowIndex; |
|
Value | |
Integer. |
|
Default | |
None. |
sectionRowIndex | NN 6 IE 4 DOM 1 |
Read-only | |
Returns a zero-based integer representing the position of the current row among all other tr elements in the row grouping. A row grouping can be one of the following elements: thead, tbody, tfoot. The count is based on the source code order of the tr elements. |
|
Example | |
var whichRow = document.getElementById("myTR").sectionRowIndex; |
|
Value | |
Integer. |
|
Default | |
None. |
vAlign | NN 6 IE 4 DOM 1 |
Read/Write | |
Indicates the manner of vertical alignment of text within the cells of the current row. |
|
Example | |
document.getElementById("myTR").vAlign = "baseline"; |
|
Value | |
Case-insensitive constant (as a string): baseline | bottom | middle | top. |
|
Default | |
middle |
deleteCell( ) | NN 6 IE 4 DOM 1 |
deleteCell(index) | |
Removes a td or th element nested within the current tr element. The integer parameter points to the zero-based item in the row's cells collection. |
|
Parameters | |
|
|
Returned Value | |
None. |
insertCell( ) | NN 6 IE 4(Win) DOM 1 |
insertCell(index) | |
Inserts a td element nested within the current tr element. The integer parameter points to the zero-based index in the cells collection where the new cell should go, but in IE you can also use the shortcut value of -1 to append the cell to the end of the collection. Adding the cell inserts an empty element, to which you add content via the various document tree modification techniques. Unfortunately, scripting the addition of table rows and cells in IE for the Macintosh (including Version 5.1) is very broken, yielding elephantine row and cell dimensions. For nonnested tables, you might be able to get away with regular document tree node creation and insertion instead of the table section object convenience methods. |
|
Parameters | |
|
|
Returned Value | |
Reference to the newly inserted cell. |