K
kaeli
Okay, trying to get the for...in loop syntax and obviously doing
something wrong.
I have a form and a select with options.
The explicit indexing I usually use works fine and alerts all the
values.
The for...in loop gives undefined for both IE and NN, but for IE, kills
it with way too many alerts. NN6 gives the right number of alerts (5
options, 5 alerts) but all say undefined.
Anyone know what I did wrong? AFAIK, selectElement.options is an array
of objects and should be able to use this...
function methodTapeCheck(frm)
{
oddTT = frm.elements["oddTapeType"];
alert("looping with explicit index");
for (x=0; x<oddTT.options.length; x++)
{
alert(oddTT.options[x].value); // alerts values correctly
}
alert("looping with for...in");
for (var o in oddTT.options)
{
alert(o.value); // alerts "undefined" for all; kills IE6
}
}
TIA
something wrong.
I have a form and a select with options.
The explicit indexing I usually use works fine and alerts all the
values.
The for...in loop gives undefined for both IE and NN, but for IE, kills
it with way too many alerts. NN6 gives the right number of alerts (5
options, 5 alerts) but all say undefined.
Anyone know what I did wrong? AFAIK, selectElement.options is an array
of objects and should be able to use this...
function methodTapeCheck(frm)
{
oddTT = frm.elements["oddTapeType"];
alert("looping with explicit index");
for (x=0; x<oddTT.options.length; x++)
{
alert(oddTT.options[x].value); // alerts values correctly
}
alert("looping with for...in");
for (var o in oddTT.options)
{
alert(o.value); // alerts "undefined" for all; kills IE6
}
}
TIA