w3schools    w3Schools
Search :
   
HOME HTML CSS XML JAVASCRIPT ASP PHP SQL MORE...   References Examples Forum About
ADVERTISEMENTS

XML Certification
Download XML editor
Custom Programming
 
Table of contents
HTML DOM
DOM HOME
DOM Intro
DOM Nodes
DOM Node Tree
DOM Methods
DOM Node Access
DOM Node Info
DOM How To
DOM Events
DOM Reference
DOM Summary

DOM Examples
DOM Examples

DOM Objects
DOM Window
DOM Navigator
DOM Screen
DOM History
DOM Location

DOM Document

DOM Anchor
DOM Area
DOM Base
DOM Body
DOM Button
DOM Event
DOM Form
DOM Frame
DOM Frameset
DOM IFrame
DOM Image
DOM Input Button
DOM Input Checkbox
DOM Input File
DOM Input Hidden
DOM Input Password
DOM Input Radio
DOM Input Reset
DOM Input Submit
DOM Input Text
DOM Link
DOM Meta
DOM Object
DOM Option
DOM Select
DOM Style
DOM Table
DOM TableCell
DOM TableRow
DOM Textarea

Selected Reading
Web Statistics
Web Glossary
Web Hosting
Web Quality

Browse Tutorials
 

HTML DOM rows Collection


Table Object Reference Complete Table Object Reference

Definition and Usage

The rows collection returns an array containing each row in a table.

Syntax

tableObject.rows[]


Example

The following example uses the rows collection to alert the content of the first row:

<html>
<head>
<script type="text/javascript">
function showRow()
  {
  alert(document.getElementById('myTable').rows[0].innerHTML)
  }
</script>
</head>
<body>
<table id="myTable" border="1">
<tr>
<td>Row1 cell1</td>
<td>Row1 cell2</td>
</tr>
<tr>
<td>Row2 cell1</td>
<td>Row2 cell2</td>
</tr>
</table>
<br />
<input type="button" onclick="showRow()" value="Show innerHTML">
</body>
</html>


Try-It-Yourself Demos

InnerHTML of a row

Add a cell to a table row through the rows collection

Align the cell content in a table row

Vertical align the cell content in a table row

Align the cell content in a single cell

Vertical align the cell content in a single cell

Change the content of a table cell

Change the colspan of a table row


Table Object Reference Complete Table Object Reference