Click to See Complete Forum and Search --> : accessing select name attribute
mahugl
10-05-2003, 11:50 AM
I am able to use the name attribute for text, textbox, checkbox, and radios but I am having trouble with select. Here is what I am trying.
for(i=0;i<document.forms[0].elements.length;i++)
{
if(document.forms[0].elements[i].type == "select")
{
stname=document.forms[0].elements[i].name;
}
}
Thanks for your help:confused:
Charles
10-05-2003, 12:10 PM
See http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/select.html#1193467.
mahugl
10-05-2003, 12:32 PM
that is not an answer. Thanks anyway. I have checked that out before I posted. There seems to be something wrong with my code.
Charles
10-05-2003, 01:00 PM
Originally posted by mahugl
There seems to be something wrong with my code. Yes, document.forms[0].elements[i].type == "select" will never return true. See http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/select.html#1193467.
mahugl
10-05-2003, 01:10 PM
thanks Charles for responding to my post quickly. When I was explaining why I was frustrated to my fiance I realized I didn't put the type for my select down in the form. Stupid me. Thanks again for the response and next time I will supply more of the code.