获取checkbox的值
<SCRIPT LANGUAGE="JavaScript">
function selectInst(){
var checkbox = document.getElementsByName("inst");
for(i=0;i<checkbox.length;i++){
if(checkbox[i].checked){
var temp = checkbox[i].value;
alert(temp);
}
}
}
</SCRIPT>
<form>
选择爱好:<br>
<input type="checkbox" name="inst" value="足球">足球
<input type="checkbox" name="inst" value="篮球">篮球
<input type="checkbox" name="inst" value="音乐">音乐
<input type="checkbox" name="inst" value="上网">上网
<input type="checkbox" name="inst" value="跳舞">跳舞
<input type="button" value="提交" onclick="selectInst()">
</form>