[Javascript] readout option and compare
Peter Brunone
peter at brunone.com
Tue Sep 6 09:04:35 CDT 2005
Hi Michael,
FYI, it's called the text (not the option of the option) :)
function getText() {
var theSelect = document.forms[0].myselect;
return theSelect.options[theSelect.selectedIndex].text;
}
You can of course parameterize this to make it a bit more
flexible depending on how you call it... But that's the basic idea.
Cheers,
Peter
-----Original Message-----
From: javascript-bounces at LaTech.edu On Behalf Of Michael Borchers
i need to readout the option (not the value) in a select menu and see if
it contains a certrain string. f.e.:
<select name="myselect">
<option value="0">first option</option>
<option value="1">next option</option>
<option value="2">another one</option>
</select>
and then find out if the selected option f.e. contains the string
"option" (which would be true for value 0,1 but false for 2)
a little function, someone?
thanks
More information about the Javascript
mailing list