Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding a checkbox control in a table

Status
Not open for further replies.

drdexter33

Programmer
Jun 11, 2003
17
US
Hello.

who can tell me how to interate through an HTML table and find a checkbox control?


Here's what I have so far:

for(var i=1;i<document.all.htmlTable.rows.length;i++)
{
for(var j=0;j<document.all.htmlTable.rows.cells.length;j++)
{
}
}

The checkbox is always in cell[0]...

Thanks.

Doug
 
First, document.all is IE only, and not a good choice for writing compatible Javascript code.

I would use document.forms['formname'].elements to search through the form elements array, and then check either for the name you're after (or an identifying part of it), or the type checkbox.

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top