View Full Version : retrieve all the row id'
phani
01-01-2003, 10:01 AM
How to retrieve all the row id's in the javascript.i have given id's to the rows of the table and want to retrieve the id's of this rows.
Thank you in advance
phani
Zvona
01-01-2003, 01:44 PM
<!-- Example written by Zvona -->
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fi">
<head>
<title>getRows()</title>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1;" />
<script type="text/javascript">
<!--
function getRows(oTable)
{
var aTemp = oTable.getElementsByTagName('tr');
var aRows = new Array();
for (var iI=0;iI<aTemp.length;iI++)
{
aRows[iI] = aTemp[iI].id;
}
return aRows;
}
window.onload = function init()
{
var aIdOfRow = getRows(document.getElementById('tblExample'));
}
// -->
</script>
</head>
<body>
<table id="tblExample" border="1">
<tr id="trOne">
<td>Foo</td>
</tr>
<tr id="trTwo">
<td>bar</td>
</tr>
</table>
</body>
</html>
phani
01-02-2003, 04:02 AM
Thank u , this could solve my problem.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.