S
stevewy
I'm looking to manipulate/check the state of various checkboxes and
radios in a form. Because I don't want to access all of the
checkboxes in the form, only a specific section, I am trying to narrow
down the list of elements to check. I thought I could place those
elements within a named DIV or a table, and then reference that DIV or
table by its ID. But it's not working.
Say for instance I wanted Javascript to issue an alert (just for
testing purposes), giving me the number of elements in a Table. If
the Table's ID was "fred", why does the instruction below not work?
alert(document.getElementById('fred').elements.length)
It comes up with an error saying it's "Null or not an object". Any
ideas? Is this just not possible, or am I doing it wrong?
If I use the name of the form (which is called "form" as well), to do:
alert(document.form.getElementById('fred').elements.length)
.... it says the Object doesn't support this property or method.
Steve Wylie
radios in a form. Because I don't want to access all of the
checkboxes in the form, only a specific section, I am trying to narrow
down the list of elements to check. I thought I could place those
elements within a named DIV or a table, and then reference that DIV or
table by its ID. But it's not working.
Say for instance I wanted Javascript to issue an alert (just for
testing purposes), giving me the number of elements in a Table. If
the Table's ID was "fred", why does the instruction below not work?
alert(document.getElementById('fred').elements.length)
It comes up with an error saying it's "Null or not an object". Any
ideas? Is this just not possible, or am I doing it wrong?
If I use the name of the form (which is called "form" as well), to do:
alert(document.form.getElementById('fred').elements.length)
.... it says the Object doesn't support this property or method.
Steve Wylie