DOM Objects
DOM Anchor
DOM Applet
DOM Area
DOM Base
DOM Basefont
DOM Body
DOM Button
DOM Checkbox
DOM Document
DOM Event
DOM FileUpload
DOM Form
DOM Frame
DOM Frameset
DOM Hidden
DOM History
DOM Iframe
DOM Image
DOM Link
DOM Location
DOM Meta
DOM Navigator
DOM Option
DOM Password
DOM Radio
DOM Reset
DOM Screen
DOM Select
DOM Style
DOM Submit
DOM Table
DOM TableData
DOM TableHeader
DOM TableRow
DOM Text
DOM Textarea
DOM Window

Table Object

The Table object represents an HTML table element.

The Table object's collections, properties, methods and events are described below:

N: Netscape (including Mozilla when N6 or higher), IE: Internet Explorer, W3C: World Wide Web Consortium (Internet Standard)

Collections

Collection Description N IE  W3C
cells[] Returns an array containing each columns in the table   5 No
rows[] Returns an array containing each row in the table 6 4 Yes
tBodies[] Returns an array containing each tbody the table   4 Yes

Properties

Syntax: object.property_name

Property Description N IE  W3C
accesskey Sets or returns the keyboard key to access the table   4 No
align Sets or returns the alignment of the table according to the surrounding text 6 4 Yes
background Sets or returns the background image of the table   4 No
bgColor Sets or returns the background color of the table 6 4 Yes
border Sets or returns the width of the table border 6 4 Yes
borderColor Sets or returns the color of the table border   5.5 No
caption Sets or returns the caption of the table 6 4 Yes
cellPadding Sets or returns the amount of space space between the cell border and cell content 6 4 Yes
cellSpacing Sets or returns the amount of space between cells in the table 6 4 Yes
cols Sets or returns the number of columns in the table   4 No
disabled Sets or returns whether or not the table should be disabled   5.5 No
frame Sets or returns which borders to render around the table. Possible values are:
  • void
  • above
  • below
  • hsides
  • vsides
  • lhs
  • rhs
  • box
  • border
6 4 Yes
height Sets or returns the height of the table 6 4 Yes
id Sets or returns the id of the table (In IE 4 this property is read-only)   4 No
rules Sets or returns which inner-borders to display. Possible values are:
  • none
  • groups
  • rows
  • cols
  • all
6 4 Yes
summary Sets or returns a description of the table 6 6 Yes
tabIndex Sets or returns the tab order for the table   4 No
tFoot Returns the TFoot object of the table 6 4 Yes
tHead Returns the THead object of the table 6 4 Yes
width Sets or returns the width of the table 6 4 Yes

Methods

Syntax: object.method_name()

Method Description N IE W3C
blur() Removes focus from the table   4 No
click() Simulates a mouse-click on the table   4 No
createCaption() Creates an empty caption element in the table 6 4 Yes
createTFoot() Creates an empty tFoot element in the table 6 4 Yes
createTHead() Creates an empty tHead element in the table 6 4 Yes
deleteCaption() Deletes the caption element and its content from the table 6 4 Yes
deleteRow([i]) Deletes the specified row (tr) from the table 6 4 Yes
deleteTFoot() Deletes the tFoot element and its content from the table 6 4 Yes
deleteTHead() Deletes the tHead element and its content from the table 6 4 Yes
focus() Sets focus on the table   4 No
insertRow([i]) Creates a new row in the table 6 4 Yes
moveRow(from,to) Moves a row to a new position   5 No
refresh() Refreshes the content of the table   4 No

Events

Syntax: object.event_name="someJavaScriptCode"

Event Description N IE W3C
onBlur Executes some code when the table loses focus   4  
onClick Executes some code when the user clicks on the table   4  
onFocus Executes some code when the table gets focus   4  
onSelectStart Executes some code when the table is selected   4