form 纯js 判断 radio 是否选择
<script type="text/javascript">function check_form()
{
var temp_r_count=0;
for(var i = 0 ; i <document.personal.temp.length; i++)
{
if(document.personal.temp[i].checked)
{
temp_r_count++;
}
}
if(0==temp_r_count)
{
alert("你什么也没有选择");
return false;
}
}
</script>
<form onsubmit="return check_form()">
<input type="radio" name="temp" > 男
<input type="radio" name="temp" > 女
</form>
form 纯js 判断 radio 是否选择。