AW: [Javascript] readout option and compare

Michael Borchers borchers at tridem.de
Tue Sep 6 09:49:02 CDT 2005


>function getText() {
	var theSelect = document.forms[0].myselect;
	return theSelect.options[theSelect.selectedIndex].text;
	}
<

thanks peter,
and how do i compare with javascript, with the IndexOf function?

<select name="myselect">
<option value="0">first option</option>
<option value="1">next option</option>
<option value="2">another one</option>
</select>

let's say the string is "option" and we search it within theSelect.options[theSelect.selectedIndex].text
?!



More information about the Javascript mailing list