This should be really easy, but I'm a novice at webapps.... I have a simple drop down list in my JSP which I created using <select> and <options>. I've got a javascript function in which I would like to get the selected value and proceed to do other stuff with that value. The list populates correctly, but I can't seem to get the selected value.
<form action="noaction" >
<select name="selectCounty" onchange="getRegions()">
<option value="" selected="selected">----- Select A country -----</option>
<%
String[] countries = country.getCountryList();
for(int i = 0; i < country.getCountryCount(); i++)
{
%>
<option id="<%=i%>" ><%=countries[i] %></option>
<%
}
%>
</select>
</form>
<SCRIPT language="javascript" type="text/javascript">
function getRegions()
{
oListBox = document.forms[0].selectCountry
alert(oListBox.options[1].text);
}
</SCRIPT>