[
Lists Home |
Date Index |
Thread Index
]
Hi
I am trying to write a reusable function that I can use to get the text of a
select object. I do not know the name of the select, I am walking through a
form.
Here is what I have tried. It does not like the use of the
toString(elements[intLoop].getAttribute('name'))
in the last line.
strField = elements[intLoop].getAttribute('value');
// if the field is a select box the value from the line above will
// be null even if there is a value in the box.
// you need the option selected value for the strField variable
if (strField == null || strField == "") {
var OptionsList =
document.forms[0].toString(elements[intLoop].getAttribute('name'));
strField =
document.forms[0].toString(document.forms[0].getAttribute('name')).options[O
ptionsList.selectedIndex].text;
}
|