public interface

HTMLTableElement

implements HTMLElement
org.w3c.dom.html.HTMLTableElement

Class Overview

The create* and delete* methods on the table allow authors to construct and modify tables. HTML 4.0 specifies that only one of each of the CAPTION , THEAD , and TFOOT elements may exist in a table. Therefore, if one exists, and the createTHead() or createTFoot() method is called, the method returns the existing THead or TFoot element. See the TABLE element definition in HTML 4.0.

See also the Document Object Model (DOM) Level 2 Specification.

Summary

[Expand]
Inherited Constants
From interface org.w3c.dom.Node
Public Methods
abstract HTMLElement createCaption()
Create a new table caption object or return an existing one.
abstract HTMLElement createTFoot()
Create a table footer row or return an existing one.
abstract HTMLElement createTHead()
Create a table header row or return an existing one.
abstract void deleteCaption()
Delete the table caption, if one exists.
abstract void deleteRow(int index)
Delete a table row.
abstract void deleteTFoot()
Delete the footer from the table, if one exists.
abstract void deleteTHead()
Delete the header from the table, if one exists.
abstract String getAlign()
Specifies the table's position with respect to the rest of the document.
abstract String getBgColor()
Cell background color.
abstract String getBorder()
The width of the border around the table.
abstract HTMLTableCaptionElement getCaption()
Returns the table's CAPTION , or void if none exists.
abstract String getCellPadding()
Specifies the horizontal and vertical space between cell content and cell borders.
abstract String getCellSpacing()
Specifies the horizontal and vertical separation between cells.
abstract String getFrame()
Specifies which external table borders to render.
abstract HTMLCollection getRows()
Returns a collection of all the rows in the table, including all in THEAD , TFOOT , all TBODY elements.
abstract String getRules()
Specifies which internal table borders to render.
abstract String getSummary()
Description about the purpose or structure of a table.
abstract HTMLCollection getTBodies()
Returns a collection of the defined table bodies.
abstract HTMLTableSectionElement getTFoot()
Returns the table's TFOOT , or null if none exists.
abstract HTMLTableSectionElement getTHead()
Returns the table's THEAD , or null if none exists.
abstract String getWidth()
Specifies the desired table width.
abstract HTMLElement insertRow(int index)
Insert a new empty row in the table.
abstract void setAlign(String align)
abstract void setBgColor(String bgColor)
abstract void setBorder(String border)
abstract void setCaption(HTMLTableCaptionElement caption)
abstract void setCellPadding(String cellPadding)
abstract void setCellSpacing(String cellSpacing)
abstract void setFrame(String frame)
abstract void setRules(String rules)
abstract void setSummary(String summary)
abstract void setTFoot(HTMLTableSectionElement tFoot)
abstract void setTHead(HTMLTableSectionElement tHead)
abstract void setWidth(String width)
[Expand]
Inherited Methods
From interface org.w3c.dom.Element
From interface org.w3c.dom.Node
From interface org.w3c.dom.html.HTMLElement

Public Methods

public abstract HTMLElement createCaption ()

Create a new table caption object or return an existing one.

Returns
  • A CAPTION element.

public abstract HTMLElement createTFoot ()

Create a table footer row or return an existing one.

Returns
  • A footer element (TFOOT ).

public abstract HTMLElement createTHead ()

Create a table header row or return an existing one.

Returns
  • A new table header element (THEAD ).

public abstract void deleteCaption ()

Delete the table caption, if one exists.

public abstract void deleteRow (int index)

Delete a table row.

Parameters
index The index of the row to be deleted. This index starts from 0 and is relative to all the rows contained inside the table, regardless of section parentage.
Throws
DOMException INDEX_SIZE_ERR: Raised if the specified index is greater than or equal to the number of rows or if the index is negative.

public abstract void deleteTFoot ()

Delete the footer from the table, if one exists.

public abstract void deleteTHead ()

Delete the header from the table, if one exists.

public abstract String getAlign ()

Specifies the table's position with respect to the rest of the document. See the align attribute definition in HTML 4.0. This attribute is deprecated in HTML 4.0.

public abstract String getBgColor ()

Cell background color. See the bgcolor attribute definition in HTML 4.0. This attribute is deprecated in HTML 4.0.

public abstract String getBorder ()

The width of the border around the table. See the border attribute definition in HTML 4.0.

public abstract HTMLTableCaptionElement getCaption ()

Returns the table's CAPTION , or void if none exists.

public abstract String getCellPadding ()

Specifies the horizontal and vertical space between cell content and cell borders. See the cellpadding attribute definition in HTML 4.0.

public abstract String getCellSpacing ()

Specifies the horizontal and vertical separation between cells. See the cellspacing attribute definition in HTML 4.0.

public abstract String getFrame ()

Specifies which external table borders to render. See the frame attribute definition in HTML 4.0.

public abstract HTMLCollection getRows ()

Returns a collection of all the rows in the table, including all in THEAD , TFOOT , all TBODY elements.

public abstract String getRules ()

Specifies which internal table borders to render. See the rules attribute definition in HTML 4.0.

public abstract String getSummary ()

Description about the purpose or structure of a table. See the summary attribute definition in HTML 4.0.

public abstract HTMLCollection getTBodies ()

Returns a collection of the defined table bodies.

public abstract HTMLTableSectionElement getTFoot ()

Returns the table's TFOOT , or null if none exists.

public abstract HTMLTableSectionElement getTHead ()

Returns the table's THEAD , or null if none exists.

public abstract String getWidth ()

Specifies the desired table width. See the width attribute definition in HTML 4.0.

public abstract HTMLElement insertRow (int index)

Insert a new empty row in the table. The new row is inserted immediately before and in the same section as the current index th row in the table. If index is equal to the number of rows, the new row is appended. In addition, when the table is empty the row is inserted into a TBODY which is created and inserted into the table. Note. A table row cannot be empty according to HTML 4.0 Recommendation.

Parameters
index The row number where to insert a new row. This index starts from 0 and is relative to all the rows contained inside the table, regardless of section parentage.
Returns
  • The newly created row.
Throws
DOMException INDEX_SIZE_ERR: Raised if the specified index is greater than the number of rows or if the index is negative.

public abstract void setAlign (String align)

public abstract void setBgColor (String bgColor)

public abstract void setBorder (String border)

public abstract void setCaption (HTMLTableCaptionElement caption)

public abstract void setCellPadding (String cellPadding)

public abstract void setCellSpacing (String cellSpacing)

public abstract void setFrame (String frame)

public abstract void setRules (String rules)

public abstract void setSummary (String summary)

public abstract void setTFoot (HTMLTableSectionElement tFoot)

public abstract void setTHead (HTMLTableSectionElement tHead)

public abstract void setWidth (String width)