Object: HTMLTableElement
Availability
|
BlackBerry®
Device Software version 4.6 or later
|
Extends
|
HTMLElement
|
The HTMLTableElement object represents a <table> element. You can use the methods to add or remove rows from a table.
The <table> element specifies the start of a table.
HTMLTableElement properties
Property name
|
Type
|
Description
|
Status
|
Availability
|
align
|
String
|
Specifies the horizontal alignment of the table.
|
writable
|
4.6 or later
|
bgColor
|
String
|
Specifies the background color for the table.
|
writable
|
4.6 or later
|
border
|
String
|
Specifies the thickness of the border around the table cells.
|
writable
|
4.6 or later
|
caption
|
HTMLTableCaptionElement
|
Specifies a pointer to the <caption> element for the table.
When setting a value for this property, if you specify an element that is not a <caption> element, this property throws a HIERARCHY_REQUEST_ERR.
|
writable
|
4.6 or later
|
cellPadding
|
String
|
Specifies the amount of white space, in pixels, to add between cell content and its borders.
|
writable
|
4.6 or later
|
cellSpacing
|
String
|
Specifies the amount of white space, in pixels, to add between cells.
|
writable
|
4.6 or later
|
frame
|
String
|
Specifies for which sides of the table the border will be visible.
|
writable
|
4.6 or later
|
rows
|
HTMLCollection
|
Returns an index of the rows contained within the table, starting at 0.
|
read only
|
4.6 or later
|
rules
|
String
|
Specifies the location of rules in the table.
|
writable
|
4.6 or later
|
summary
|
String
|
Specifies summary text that describes the contents of the table.
|
writable
|
4.6 or later
|
tBodies
|
HTMLCollection
|
Returns an index of all the <tbody> element in the table.
|
read only
|
4.6 or later
|
tFoot
|
HTMLTableCaptionElement
|
Specifies a pointer to the <tfoot> element for the table.
When setting a value for this property, if you specify an element that is not a <tfoot> element, this property throws a HIERARCHY_REQUEST_ERR.
|
writable
|
4.6 or later
|
tHead
|
HTMLTableCaptionElement
|
Specifies a pointer to the <thead> element for the table.
When setting a value for this property, if you specify an element that is not a <thead> element, this property throws a HIERARCHY_REQUEST_ERR.
|
writable
|
4.6 or later
|
width
|
String
|
Specifies the width of the table, in pixels, or as a percentage of the BlackBerry® Browser window.
|
writable
|
4.6 or later
|
HTMLTableElement methods
Method name
|
Description
|
Availability
|
createCaption()
|
Creates a new table caption, if the table does not already contain one.
|
4.6 or later
|
createTFoot()
|
Creates a new table footer, it the table does not already contain one.
|
4.6 or later
|
createTHead()
|
Creates a new table header, if the table does not already contain one.
|
4.6 or later
|
deleteCaption()
|
Removes the caption from the table, if one exists.
|
4.6 or later
|
deleteRow()
|
Removes the row at the given index position from the table.
|
4.6 or later
|
deleteTFoot()
|
Removes the footer from the table, if one exists.
|
4.6 or later
|
deleteTHead()
|
Removes the header from the table, if one exists.
|
4.6 or later
|
insertRow()
|
Inserts a new empty row into the table at the given index position.
|
4.6 or later
|
Method: HTMLTableElement.createCaption()
The createCaption() method creates a new table caption, if the table does not already contain one. If a table caption already exists, this method returns it.
Syntax
HTMLTableElement.createCaption()
Return values
Returns the new table caption, or the existing table caption, if the table already contains one.
Method: HTMLTableElement.createTHead()
Availability
|
BlackBerry®
Device Software version 4.6 or later
|
The createTHead() method creates a new table header, if the table does not already contain one. If a table header already exists, this method returns it.
Syntax
HTMLTableElement.createTHead()
Return values
Returns the new table header, or the existing table header, if the table already contains one.
Method: HTMLTableElement.deleteCaption()
Availability
|
BlackBerry®
Device Software version 4.6 or later
|
The deleteCaption() method removes the caption from the table, if one exists.
Syntax
HTMLTableElement.deleteCaption()
Method: HTMLTableElement.deleteRow()
Availability
|
BlackBerry®
Device Software version 4.6 or later
|
The deleteRow() method removes the row at the given index position from the table.
Syntax
HTMLTableElement.deleteRow( index )
Parameters
Parameter
|
Type
|
Description
|
index
|
int
|
The index position of the row to remove from the table.
If index has a value of -1, or is equal to the number of rows in the table, the last row in the table is removed.
|
Exceptions
Exception
|
Description
|
INDEX_SIZE_ERR
|
This error is thrown if index exceeds the number of rows in the table, or has a negative value other than -1.
|
Method: HTMLTableElement.deleteTHead()
Availability
|
BlackBerry®
Device Software version 4.6 or later
|
The deleteTHead() method removes the header from the table, if one exists.
Syntax
HTMLTableELement.deleteTHead()
Method: HTMLTableElement.insertRow()
Availability
|
BlackBerry®
Device Software version 4.6 or later
|
The insertRow() method inserts a new empty row into the table at the given index position.
Once the new row is added, you can populate it with table cells using HTMLTableRowElement.insertCell().
Syntax
HTMLTableElement.insertRow( index )
Parameters
Parameter
|
Type
|
Description
|
index
|
int
|
The index position at which to insert the new row in the table.
If index has a value of -1, or is equal to the number of rows in the table, the new row is added to the end of the table.
|
Return values
Returns the newly added row.
Exceptions
Exception
|
Description
|
INDEX_SIZE_ERR
|
This error is thrown if index exceeds the number of rows in the table, or has a negative value other than -1.
|
Was this information helpful? Send us your comments.