<form name=”myform” action=”” method=”” onsubmit=”return check()”>
<input type=”radio” name=”picno” value=”1″>选择1
<input type=”radio” name=”picno” value=”2″>选择2
<input type=”radio” name=”picno” value=”3″>选择3
<input type=”submit” value=”Submit”>
<input type=”reset” value=”Reset”>
</form>
<script language=”JavaScript”>
function check(){
var flag=0;
for(i=0;i<myform.picno.length;i++)
if(myform.picno[i].checked==true){
flag=1;
break;
}
if(!flag){
alert(“请先选择!”);
return false;
}
}
</script>
评论