Multiple selection of Drop down listbox onChange

Sangwan Pankaj Reply 10:18

Multiple selection of a drop down listbox by using onChange event trigger. 
HTML CODE
<select id=p1 name=no_year onChange="show_month()"; multiple size=4><option value=Jan>January</option>
<option value=February>February</option>
<option value=March>March</option>
<option value=April>April</option>
<option value=June>June</option>
<option value=Jul>July</option>
<option value=Auguest>Auguest</option>
<option value=September>Septembr</option>
<option value=October>October</option>
<option value=November>November</option>
<option value=December>December</option>
</select>
<div id='getValue'><br><br></div>

JAVASCTIPT
<script type="text/javascript">
function show_month(){
var str='';
for (i=0;i<p1.length;i++) {
if(p1[i].selected){
str +=p1[i].value + "<br >";
}
}
document.getElementById("getValue").innerHTML=str;
return true;
}
</script>

Related Posts

Javascript 3356675448518532170
Copyright by GhostPHP. Powered by Blogger.

Search

Recent Post

Popular Posts

Follow us