<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
//라디오버튼 클릭 여부 확인
window.radioTest=function(){
var genderRadio = document.form3.gender;
var cnt = 0;
for(i=0;i<genderRadio.length;i++){
if(genderRadio[i].checked){
cnt++;
flag=true;
alert(genderRadio[i].value+" : "+genderRadio[i].checked);
break;
}
}
if(cnt==0){
alert("성별을 선택하세요");
}else{
alert("성별을 선택하셨습니다.");
}
if(!flag){
alert("성별을 선택하세요.");
}
}
</script>
</head>
<body>
라디오버튼 테스트<br>
<form name="form3">
남 : <input type="radio" name="gender" value="남" >
여 : <input type="radio" name="gender" value="여">
<input type="button" value="전송" onclick="radioTest()">
</form>
</body>
</html>