Click to See Complete Forum and Search --> : '[]' in select box name - cant read?


lazzerous
11-13-2003, 04:27 PM
I have serveral select boxes that are automatically generated.
They are named as such:
pb[0]
pb[1]
pb[2]
etc...

When trying to reference to these objects directly, I get an error saying what I'm referencing to is 'null or not an object':

for (i = 0; i < 10; i++)
{
var poo = document.form.pb[i].options[document.form.pb[i].options[0].selected].value;
alert(poo);
}


Exact Error:
Error: 'document.form.pb' is null or not an object.

Anyone know why it wont recognize these values?

Thanks you
-=Lazzerous=-

Charles
11-13-2003, 04:39 PM
From the HTML 4.01 Specification:
ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
http://www.w3.org/TR/html4/types.html#type-nameThat's what you get when you go breaking the rules.