JavaScript uses select to dynamically change the image. javascriptselect
This example describes how to dynamically change an image by using select in JavaScript. Share it with you for your reference. The specific analysis is as follows:
The following JS Code triggers the SetBeerIcon () function when the select list changes. The SetBeerIcon () function can dynamically modify the Image Based on the selected select value.
...<script language="JavaScript" type="text/javascript" >function setBeerIcon() { var beerIcon = document.getElementById("beerIcon"); beerIcon.src = "images/"+getSelectValue("beer")+".jpg";}</script>...<select name="beer" id="beer" onChange="setButton();setBeerIcon();"><option value="--Select--">Select beer</option> <option value="heineken">heineken</option> <option value="sol">sol</option> <option value="amstellight">amstellight</option> <option value="coronalight">coronalight</option> <option value="coronaextra">coronaextra</option> <option value=""></option></select>
I hope this article will help you design javascript programs.