Drop down listbox onChange event

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>
Demo of OnChange Listbox

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>
OnChange event of dropdown list box to trigger a function to reload the page with selected data


Selection of Multiple selection listbox Listbox Adding option to Listbox
JavaScript Validation
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    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-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer