我有一个下拉类表(可以多选)怎么判断我选择了几项啊!
<select name= "zjlb1 " size= "15 " multiple style= "width:150px; height:200px; ">
<option value= "1 "> 100 </option>
<option value= "2 "> 200 </option>
<option value= "3 "> 300 </option>
<option value= "4 "> 400 </option>
</select>
就这个 我可以多选 但是怎么才能判断我选择了几项和选择这几项的ID啊!
谢谢大家了!
------解决方案-------------------- <select name= "zjlb1 " size= "15 " multiple style= "width:150px; height:200px; ">
<option value= "1 "> 100 </option>
<option value= "2 "> 200 </option>
<option value= "3 "> 300 </option>
<option value= "4 "> 400 </option>
</select>
<input name= "button1 " type= "button " value= "check " onclick=show()>
<script language=javascript>
function show()
{
var obj=document.getElementById( "zjlb1 ")
for(var i=0;i <obj.options.length;i++)
{
if(obj.options[i].selected)
{
alert(obj.options[i].value)
}
}
}
</script>