<!DOCTYPE html>
<html>
<head>
<meta charset=UTF-8>
<title>유효성 검사 테스트</title>
</head>
<body>
<script>
function check_onclick(){
var theForm = document.frm1;
if(theForm.input1.value == "" || theForm.input2.value == "" || theForm.input3.value = "")
{
if(theForm.input1.value = "")
{
alert("필수 입력칸1이 비었습니다.");
return theForm.input1.focus();
}
else if(theForm.input2.value = "")
{
alert("필수 입력칸2가 비었습니다.");
return theForm.input2.focus();
}
else(theForm.input3.value = "")
{
alert("필수 입력칸3이 비었습니다.");
return theForm.input3.focus()
}
}
else
{
alert("필수입력칸의 모두 입력하였습니다.");
}
}
</script>
<FORM name = "frm1">
필수입력란1 : <input type = text name = input1 size = 10><br>
필수입력란2 : <input type = text name = input2 size = 10><br>
필수입력란3 : <input type = text name = input3 size = 10><br>
보통입력란4 : <input type = text name = input4 size = 10>(생략가능)<br>
<input type = button value = "check" onclick = "check_onclick()">
</FORM>
</body>
</html>
javascript 연습도중 alert창이 안떠요 체크를 눌르면 아무런 반응이없습니다ㅠ