OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   trying to get the text of a select box in reusable function

[ 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;
}




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS