This article illustrates how JavaScript dynamically replaces pictures with select. Share to everyone for your reference. The specific analysis is as follows:
The following JS code triggers the Setbeericon () function when the select list changes, and the Setbeericon () function can dynamically modify the picture based on the value selected by the Select
...
<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 with your JavaScript programming.