I\'m trying to change an image upon selection of an option in a drop down list:
function volvoCar() { var img = document.getElementById(\"image\"); img.src=\
Instead of setting the onClick event for an option, set the onChange event for the select.
onClick
onChange
HTML
No Car Volvo Audi
JavaScript
function setCar() { var img = document.getElementById("image"); img.src = this.value; return false; } document.getElementById("CarList").onchange = setCar;
Here's a working demo