[thelist] check all checkboxes, DOM etc
Tom Dell'Aringa
pixelmech at yahoo.com
Thu Sep 19 13:43:01 CDT 2002
I'm working up a demo for a client where I am using the DOM to
dynamically add rows to a table, each row has a checkbox.
At the top, you can click a checkbox to select ALL the checkboxes. I
am using this function:
function checkAllBoxes(targetform)
{
for (i = 0; i < targetform.elements.length; i++)
{
if (targetform.elements[i].type == "checkbox")
{
if(targetform.elements[i].checked == false)
{
targetform.elements[i].checked = true
}
}
}
}
--
Seems it should work, and it does when I first load the page with
only 1 default row. But once I add rows, it doesn't work. It almost
seems as if it doesn't see the new rows and checkboxes. Here is a
typical row (in fact the default row)
<tr>
<td width="16"><img src="view.gif" width="14" height="14" alt=""
/></td>
<td width="16"><input type="checkbox" id="fern"
class="checkbox"></td>
<td><label for="fern">Fernandez, Carlos</label></td>
<td>Neptune, NJ</td>
</tr>
The checkbox is added with this line from a DOM JS function:
cell.innerHTML = "<input type=\"checkbox\" id=\"box1\"
class=\"checkbox\" />";
and they do show up..any ideas??
Tom
=====
var me = tom.pixelmech.webDeveloper();
http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
More information about the thelist
mailing list