I’m not sure how to ask for the selected value from a pulldown menu. This is what I have so far:
In the HTML header:
<script language="JavaScript" type='text/javascript'>
function selectCountry(elem){
if(elem.value == "United States" || elem.value == "Canada"){
document.getElementById('div-state').style.display = '';
document.getElementById('div-state').style.visibility = '';
return false;
}else{
return true;
}
}
</script>
In the form:
<div class="optionalField" id="div-state" style="display:none;visibility:hidden;">
<label for="state">State/Province:</label>
<select tabindex="6" name="state" id="state" class="selectOne">
<option value="">Select a State/Province</option>
<option value="">---------------</option>
<option value="AL">AL - Alabama</option>
</select>
</div>
<select tabindex="8" name="country" id="country" class="selectOne required" onselect="selectCountry(document.getElementById('country');">
<option value="">Select a Country</option>
<option value="">---------------</option>
<option value="United States">US - United States</option>
<option value="Canada">CA - Canada</option>
<option value="">---------------</option>
<option value="Afghanistan">AF - Afghanistan</option>
</select>
I think I’m trying to get to this value:
e.options[e.selectedIndex].value
but I’m unsure of how to express it.