Drop down listbox onChange

We can read the selected option of a drop down list box by using onChange event trigger. The onChange event will trigger one JavaScript function and we will try to read the selected item by using getElementById
<select id=s1 name=no_year onChange="show_date()";>
....
</select>
Here is the code
<html>
<head>
<title>Demo Project on JavaScript listbox onChange</title>
</head>
<script type="text/javascript"> 
function show_date(){
document.getElementById("msg3").innerHTML= document.getElementById("s1").value;
return true;
}
</script>

</body>
<body>

<select id=s1 name=no_year onChange="show_date()";>
<option value=Jan>January</option>
<option value=Feb>February</option>
<option value=March>March</option>
<option value=April>April</option>
<option value=May>May</option>
</select>

<div id='msg3'></div>

</body>
</html>
Visitors Rating
Your Rating





More on List Box & JavaScript

Post your comments , suggestion , error , requirements etc here .




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2019 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer