Class HTMLTableElement
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The HTMLTableElement interface provides special properties and methods (beyond the regular HTMLElement object interface it also has available to it by inheritance) for manipulating the layout and presentation of tables in an HTML document.
[Value("HTMLTableElement")]
public class HTMLTableElement : HTMLElement
- Inheritance
-
HTMLTableElement
- Inherited Members
Remarks
-The HTML element implementing this interface: table.
Constructors
HTMLTableElement()
public HTMLTableElement()
Properties
Align
IMPORTANT
DeprecatedHTMLTableElement.align property represents thealignment of the table.
[Value("align")]
public string Align { get; set; }
Property Value
- string
One of the following string values:
Remarks
BgColor
IMPORTANT
Deprecatedbgcolor property of the HTMLTableElement represents thebackground color of the table.
[Value("bgColor")]
public string BgColor { get; set; }
Property Value
- string
A string representing a color value.When set to the
nullvalue, thatnullvalue is converted to the empty string (""), soelt.bgColor = nullis equivalent toelt.bgColor = "".
Remarks
NOTE
Do not use this attribute anymore. Instead, use the CSS background-color property by modifying the element's
styleattribute or using a style rule.
Border
IMPORTANT
DeprecatedHTMLTableElement.border property represents theborder width of the table element.
[Value("border")]
public string Border { get; set; }
Property Value
- string
A string representing the width of the border in pixels.
Remarks
Caption
The HTMLTableElement.caption property represents the
table caption. If no caption element is associated with the table, this property isnull.
[Value("caption")]
public HTMLTableCaptionElement? Caption { get; set; }
Property Value
- HTMLTableCaptionElement
A string.
Remarks
-The interface implementing this property: HTMLTableElement.
CellPadding
IMPORTANT
DeprecatedHTMLTableElement.cellPadding property represents thepadding around the individual cells of the table.
[Value("cellPadding")]
public string CellPadding { get; set; }
Property Value
- string
A string representing pixels (e.g.,
"10") or a percentage value (e.g.,"10%").When set to thenullvalue, thatnullvalue is converted to the empty string (""), soelt.cellPadding = nullis equivalent toelt.cellPadding = "".
Remarks
CellSpacing
IMPORTANT
Deprecated{{cssxref("border-spacing")}} property, the obsolete HTMLTableElement
interface's
cellSpacing property represents the spacingaround the individual th and td elements
representing a table's cells. Any two cells are separated by the sum of the
cellSpacing of each of the two cells.
[Value("cellSpacing")]
public string CellSpacing { get; set; }
Property Value
- string
A string which is either a number of pixels (such as
"10") or a percentage value (like"10%").When set to thenullvalue, thatnullvalue is converted to the empty string (""), soelt.cellSpacing = nullis equivalent toelt.cellSpacing = "".
Remarks
Frame
IMPORTANT
Deprecatedframeproperty is a string that indicates which of the table's exterior borders should be
drawn.
[Value("frame")]
public string Frame { get; set; }
Property Value
- string
One of the following:
Remarks
Rows
The read-only HTMLTableElement
property rows returns a live
HTMLCollection of all the rows in the table, including the rows
contained within any thead, tfoot, and
tbody elements.
[Value("rows")]
public HTMLCollection Rows { get; }
Property Value
- HTMLCollection
An HTMLCollection providing a live-updating list of the
HTMLTableRowElement objects representing all of the {{HTMLElement("tr")}}
elements contained in the table. This provides quick access to all of the table rows,
without having to manually search for them.
Remarks
Although the property itself is read-only, the returned object is live and allows the
modification of its content.
Rules
IMPORTANT
DeprecatedHTMLTableElement.rules property indicates which cellborders to render in the table.
[Value("rules")]
public string Rules { get; set; }
Property Value
- string
One of the following:
Remarks
Summary
IMPORTANT
DeprecatedHTMLTableElement.summary property represents thetable description.
[Value("summary")]
public string Summary { get; set; }
Property Value
- string
A string.
Remarks
TBodies
The HTMLTableElement.tBodies read-only property returns a
live HTMLCollection of the bodies in a {{htmlElement("table")}}.
[Value("tBodies")]
public HTMLCollection TBodies { get; }
Property Value
- HTMLCollection
A live HTMLCollection.
Remarks
Although the property is read-only, the returned object is live and allows the
modification of its content.
The collection returned includes implicit tbody elements. For
example:
The HTML DOM generated from the above HTML will have a tbody element
even though the tags are not included in the source HTML.
TFoot
The HTMLTableElement.tFoot property represents the
tfoot element of a table. Its value will benull if there is no such element.
[Value("tFoot")]
public HTMLTableSectionElement? TFoot { get; set; }
Property Value
- HTMLTableSectionElement
A tfoot element or
null.
Remarks
-The interface implementing this property: HTMLTableElement.
THead
The HTMLTableElement.tHead represents the
thead element of a table. Its value will benull if there is no such element.
[Value("tHead")]
public HTMLTableSectionElement? THead { get; set; }
Property Value
Remarks
-The interface implementing this property: HTMLTableElement.
Width
IMPORTANT
DeprecatedHTMLTableElement.width property represents thedesired width of the table.
[Value("width")]
public string Width { get; set; }
Property Value
- string
A string representing the width in number of pixels or as a percentage value.
Remarks
Methods
CreateCaption()
The HTMLTableElement.createCaption() method returns the
caption element associated with a given table.
If no <caption> element exists on the table, this method creates
it, and then returns it.
[Value("createCaption")]
public HTMLTableCaptionElement CreateCaption()
Returns
Remarks
NOTE
If no caption exists,
createCaption()inserts a
new caption directly into the table. The caption does not need to be added
separately as would be the case if CreateElement(string, Union34) had
been used to create the new<caption>element.
CreateTBody()
The createTBody() method of
HTMLTableElement objects creates and returns a new
tbody element associated with a given table.
[Value("createTBody")]
public HTMLTableSectionElement CreateTBody()
Returns
Remarks
NOTE
Unlike CreateTHead() and
CreateTFoot(),createTBody()
systematically creates a new<tbody>element, even if the table
already contains one or more bodies. If so, the new one is inserted after the existing
ones.
CreateTFoot()
The createTFoot() method of
HTMLTableElement objects returns the {{HTMLElement("tfoot")}} element
associated with a given table. If no footer exists in the table, this
method creates it, and then returns it.
[Value("createTFoot")]
public HTMLTableSectionElement CreateTFoot()
Returns
Remarks
NOTE
If no footer exists,
createTFoot()inserts a new
footer directly into the table. The footer does not need to be added separately as
would be the case if CreateElement(string, Union34) had been used to create
the new<tfoot>element.
CreateTHead()
The createTHead() method of
HTMLTableElement objects returns the {{HTMLElement("thead")}} element
associated with a given table. If no header exists in the table, this
method creates it, and then returns it.
[Value("createTHead")]
public HTMLTableSectionElement CreateTHead()
Returns
Remarks
NOTE
If no header exists,
createTHead()inserts a new
header directly into the table. The header does not need to be added separately as
would be the case if CreateElement(string, Union34) had been used to create
the new<thead>element.
DeleteCaption()
The HTMLTableElement.deleteCaption() method removes the
caption element from a given table. If there is no<caption> element associated with the table, this method does
nothing.
[Value("deleteCaption")]
public GlobalObject.Undefined DeleteCaption()
Returns
Remarks
DeleteRow(long)
[Value("deleteRow")]
public GlobalObject.Undefined DeleteRow(long index)
Parameters
indexlong
Returns
Remarks
DeleteTFoot()
[Value("deleteTFoot")]
public GlobalObject.Undefined DeleteTFoot()
Returns
Remarks
DeleteTHead()
[Value("deleteTHead")]
public GlobalObject.Undefined DeleteTHead()
Returns
Remarks
InsertRow(long)
The insertRow() method of the HTMLTableElement interface inserts a new row
(tr) in a given table, and returns a reference to
the new row.
[Value("insertRow")]
public HTMLTableRowElement InsertRow(long index = 0)
Parameters
indexlong
Returns
- HTMLTableRowElement
An HTMLTableRowElement that references the new
row.
Remarks
If a table has multiple tbody elements, by default, the new row is
inserted into the last <tbody>.
To insert the row into a specific section, use InsertRow(long)
NOTE
insertRow()inserts the row directly into the
table. The row does not need to be appended separately as would be the case if
CreateElement(string, Union34) had been used to create the new<tr>element.