This stands for table row. The number of rows in a table is exactly specified by how many <TR>
elements are contained within it, regardless of cells that may attempt to use the ROWSPAN
attribute to span into non-specified rows.
The <TR>
element can have the following attributes.
ALIGN="left|center|right"
This controls whether text inside the table cell(s) is aligned to the left, right or centre of the cell.
VALIGN="top|middle|bottom|baseline"
This attribute controls whether text inside the table cell(s) is aligned to the top, bottom, or vertically centred within the cell. It can also specify that all the cells in the row should be vertically aligned to the same baseline.
BGCOLOR="#rrggbb|colour name"
Internet Explorer and Netscape support use of this attribute (also supported in the <BODY>
element). It allows the background colour of the table to be specified, using either the specified colour names, or a rrggbb hex triplet.
BORDERCOLOR="#rrggbb|colour name"
Internet Explorer includes support for this attribute which sets the border colour of the row. Any of the pre-defined colour names can be used, as well as any colour defined by a rrggbb hex triplet. It is necessary for the BORDER
attribute to be present in the main <TABLE>
element for border colouring to work.
BORDERCOLORLIGHT="#rrggbb|colour name"
Internet Explorer allows use of the BORDERCOLORLIGHT
attribute to set independently, the lighter colour to be displayed on a 3-dimensional row border. It is the opposite of BORDERCOLORDARK
. Any of the pre-defined colour names can be used, as well as any colour defined by a rrggbb hex triplet. It is necessary for the BORDER
attribute to be present in the main <TABLE>
element for border colouring to work.
BORDERCOLORDARK="#rrggbb|colour name"
Internet Explorer allows use of the BORDERCOLORDARK
attribute to set independently, the darker colour to be displayed on a 3-dimensional row border. It is the opposite of BORDERCOLORLIGHT
. Any of the pre-defined colour names can be used, as well as any colour defined by a rrggbb hex triplet. It is necessary for the BORDER
attribute to be present in the main <TABLE>
element for border colouring to work.
BACKGROUND="URL of image"
Netscape supports the placing of images inside the <TR>
element. (Also in the <TABLE>
, and <TH>
elements) If used in the <TR>
element, the image in question will be tiled behind the entire table row. Any of the supported graphic file formats can be used as a graphic behind a table row.
NOTE : The BGCOLOR
, BORDERCOLOR
, BORDERCOLORLIGHT
and BORDERCOLORDARK
attributes can also be used in <TABLE>
, <TH>
and <TD>
elements, with the colour defined in the last element over-riding those defined before. E.g. if a <TD>
element contains a BORDERCOLOR
attribute setting, the setting specified will be used instead of any colour settings that may have been specified in the <TR>
element, which in turn over-rides any colour settings in the <TABLE>
element.
TITLE="informational ToolTip"
The Internet Explorer 4.0 (and above) specific TITLE
attribute is used for informational purposes. If present, the value of the TITLE
attribute is presented as a ToolTip when the users mouse hovers over the <TR>
section.
LANG="language setting"
The LANG
attribute can be used to specify what language the <TR>
element is using. It accepts any valid ISO standard language abbreviation (for example "en"
for English, "de"
for German etc.) For more details, see the Document Localisation section for more details.
LANGUAGE="Scripting language"
The LANGUAGE
attribute can be used to expressly specify which scripting language Internet Explorer 4.0 uses to interpret any scripting information used in the <TR>
element. It can accept values of vbscript
, vbs
, javascript
or jscript
. The first two specify the scripting language as Visual Basic Script, the latter two specify it as using Javascript (the default scripting language used if no LANGUAGE
attribute is set.
CLASS="Style Sheet class name"
The CLASS
attribute is used to specify the <TR>
element as using a particular style sheet class. See the Style Sheets topic for details.
STYLE="In line style setting"
As well as using previously defined style sheet settings, the <TR>
element can have in-line stylings attached to it. See the Style Sheets topic for details.
ID="Unique element identifier"
The ID
attribute can be used to either reference a unique style sheet identifier, or to provide a unique name for the <TR>
element for scripting purposes. Any <TR>
element with an ID
attribute can be directly manipulated in script by referencing its ID
attribute, rather than working through the All collection to determine the element. See the Scripting introduction topic for more information.
Every <TR>
element in a document is an object that can be manipulated through scripting. Note that scripting of the <TR>
element/object is only supported by Internet Explorer 4.0 in its Dynamic HTML object model. Netscape does not support direct scripting of the <TR>
element at all.
<TR...>
Properties
Of the standard Dynamic HTML properties, the <TR...>
element/object supports the following: className, document, id, isTextEdit, lang, language, offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth, outerText, parentElement, parentTextEdit, sourceIndex, style, tagName and title. Details of these can be found in the standard Dynamic HTML properties topics.
<TR>
also supports the following properties, which directly reflect attributes of the <TD>
element: align, background, bgColor, borderColorDark, borderColorLight and vAlign and:
rowIndex
The rowIndex
property returns the referenced <TR>
elements index in the Rows Collection for the main <TABLE>
element, which is subtly different to the sectionRowIndex
property (see below).
sectionRowIndex
The sectionRowIndex
property returns the referenced <TR>
elements index in the Rows Collection for either the <THEAD>
, <TBODY>
, or <TFOOT>
element. Note that the referenced <TR>
element can only have a sectionRowIndex
property in one of the <THEAD>
, <TBODY>
or <TFOOT>
sections, but will always have a rowIndex
(see above) property value for its position in the Rows Collection for the main <TABLE>
.
<TR...>
Methods
Of the standard Dynamic HTML methods, the <TR...>
element/object supports the following: click, contains, getAttribute, removeAttribute, scrollIntoView and setAttribute). Details of these can be found in the standard Dynamic HTML Methods topics.
Additionally, the <TD>
element supports:
blur
The blur
event can be used to force the users focus away from the referenced <TR>
element, firing the onblur
event.
deleteCell
The deleteCell
method deletes a given <TD>
element from the referenced Cells Collection for the referenced <TR>
element. The index, if used, should be the cellIndex
of the <TD>
element to be deleted from the <TR>
. If no index is given, the last cell in the Cells Collection referenced, will be deleted. For example:
document.all("tblExample").rows(2).deleteCell(1)
would delete the second <TD>
element contained in the third <TR>
element of the <TABLE>
element, referenced by tblExample
focus
The focus
method can be used to pass the users focus to the referenced <TR>
element, forcing the onfocus
event to fire.
insertCell
The insertCell
method inserts a new <TD>
element into the referenced <TR>
(row) element. For example:
cellNew=document.all("tblExample").rows("rowMain").insertCell(1)
would insert a new <TD>
element into the <TR>
element referenced by rowMain
<TR...>
Events
The <TR...>
element/object supports all of the standard Dynamic HTML events (i.e. onclick, ondblclick, ondragstart, onfilterchange, onhelp, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup and onselectstart). Details of these can be found in the standard Dynamic HTML events topics.
Also, the <TR>
element supports:
onafterupdate
The onafterupdate
event is fired after data is transferred from the element to the data provider and will only fire after the onbeforeupdate
event has fired and was successful. For more information on Data Binding, see the Data Binding topic.
onbeforeupdate
onbeforeupdate
fires when a data bound element loses the focus, or the current document is unloaded and will only fire if the value of the element is different to the original value that was present when the element received the users focus. Note that onbeforeupdate
is a cancelable event (setting returnValue=false
for the Event object), which allows the document /script author a chance to validate the new data entered by the user on the client-side, before sending the data to the data provider. For more information on Data Binding, see the Data Binding topic.
onblur
When the referenced <TR>
element loses the users focus, the onblur
event is fired, executing any script events that are attached to it.
onfocus
When the user passes the focus to any <TR>
element, the onfocus
event is fired for that element.
onresize
The onresize
event is fired whenever the contents of the <TR>
element are resized, by window movement, or dynamically through scripting.
onrowenter
The onrowenter
event fires on the data source control when the current record has been changed, so new data is available to populate the HTML display elements that are bound to the data source. Somewhat confusingly, this will typically happen after the onrowexit
event has been fired. For more information on Data Binding, see the Data Binding topic.
onrowexit
The onrowexit
event is fired immediately before the data source changes the current record (i.e. when the user has requested another record, or set of records by pressing a button perhaps). Note that unlike the anafterupdate
and onbeforeupdate
events, onrowexit
is fired by the data source, not any of the HTML elements used to display the data. Changes to the data in the HTML elements should have been transferred to the data source (with validation being taken care of in the on*update
events). onrowexit
will also fire if the record position is changed through scripting. For more information on Data Binding, see the Data Binding topic.
© 1995-1998, Stephen Le Hunte
Questions:
i want to insert a row using dhtml and assign id to that row,and pass that id(i.e. row id) when i click on some td.can i do this ?? this is what i have to insert with dhtml <tr id="1"><td onclick="call(parentElement)"></td></tr> plz help asap. thanks in advance+
file: /Techref/language/html/ib/Tables/tr.htm, 18KB, , updated: 2008/3/3 20:23, local time: 2024/11/28 05:25,
3.147.47.177:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://sxlist.com/Techref/language/html/ib/Tables/tr.htm"> <TR></A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to sxlist.com! |
.