Button.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Button</title>
</head>
<body>
<input type="button" name="register_button" value="가입" onclick="location.href='register.html'" >
</body>
</html>
register.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>register</title>
<script type="text/javascript">
window.onload = function(){
document.getElementById('user_id').focus();
}
function checkField(obj){
if(obj.value==''){
obj.focus();
}
}
function checkPW(obj){
if(document.getElementById('user_pw').value==document.getElementById('user_check_pw').value){
document.getElementById('check').innerHTML='확인 !'
document.getElementById('check').style.color='blue';
} else {
document.getElementById('check').innerHTML='불일치!!'
document.getElementById('check').style.color='red';
}
}
</script>
</head>
<body>
<h2>회 원 가 입</h2>
<hr>
<form action="#" name="focusTest">
<label>아이디 : </label>
<input type="text" id="user_id" name="user_id" onblur="checkField(this)" placeholder="아이디"/> <span style='color: red'>(*필수항목)</span>
<br/>
<label>비밀번호 : </label>
<input type="text" id="user_pw" name="user_pw" onblur="checkField(this)"placeholder="비밀번호"/><span style='color: red'>(*필수항목)</span>
<br/>
<label>비밀번호 확인 : </label>
<input type="text" id="user_check_pw" name="user_check_pw" onblur="checkPW(this)" placeholder="비밀번호 확인"/> <span id="check"></span>
<br/>
<label>이름 : </label>
<input type="text" id="user_name" name="user_name" placeholder="이름"/>
</form>
<hr>
<input type="button" value="등록" onclick="location.href='success.html'">
</body>
</html>
success.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>success</title>
<script type="text/javascript">
alert('가입을 축하 합니다');
</script>
</head>
<body>
</body>
</html>