I am having problems using data from a drop down list with my javascript. I want it to print out on the page based off what is selected, but so far when they select a value, nothing happens. I am new to javasript, please help:
<form>
<select name="abc" id="abc" onChange="check(this.form)">
<option value="a">A</option>
<option value="b">B</option>
<option value="c">C</option>
</select>
</form>
<script>
function check (form){
var letter = document.getElementsById("abc");
var userLtr = letter.options[letter.selectedIndex].value;
if (userLtr == "a"){
document.write ("You selected A");
}
else if(userLtr == "b"){
document.write ("You selected B");
}
else{
document.write ("You selected C");
}
}
</script>
edit: Thank you all for the help. I have figured it out!!
getElementByIdnotgetElementId. You also need some sort of event handler like onchange