IT개발/HTML CSS Javascript2010. 8. 24. 01:36
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>회원가입</title>
<link rel="Stylesheet" type="text/css" href="Register.css" />
<script language="javascript" type="text/javascript" src="Register.js">
</script>
</head>
<body>
<form name="RegisterForm" action="" method="post" onsubmit="return checkForm();">
<table border="1" width="500">
<tr>
<td colspan="2" align="center" bgcolor="blue" style="color:White;">
회원가입</td>
</tr>
<tr>
<td align="right" >아이디 :</td>
<td>
<input type="text" id="txtUserID" name="txtUserID" />
<input type="button" value="아이디 중복확인"
onclick="CheckID();"/>
</td>
</tr>
<tr>
<td align="right">비일번호 :</td>
<td>
<input type="text" id="txtPassword" name="txtPassword" />
암호확인: <input type="txt" id="txtPasswordConfirm" name = "txtPasswordConfirm" />
</td>
</tr>
<tr>
<td align="right">이름 :</td>
<td>
<input type="text" id="txtCustomerName" name="txtCustomerName" />
</td>
</tr>
<tr>
<td colspan="2" align="center" >
<input type="submit" value="회원가입" />
<input type="reset" value="취소" />
</td>
</tr>
</table>
</form>
</body>
</html>
body, td, input, textarea, select, option
{
color:black;
font-family:"맑은 고딕" verdana 굴림;
font-size:12px;
}
input
{
border:groov 1px gray;
}
function checkForm() {
// 1. 아이디 체크
if (document.getElementById("txtUserID").value.length < 3) {
window.alert("아이디를 정확하게 입력하세요");
document.getElementById("txtUserID").focus();
return false;
}
// 2.암호체크
// var pwd = document.RegisterForm.txt.Password;
var pwd = document.getElementById("txtPassword");
if (pwd.value.length < 3 || pwd.value.length > 15) {
window.alert("암호는 3자 이상 및 15자 이하로 입력하세요.");
pwd.select();
return false;
}
// 3. 이름체크
var name = document.getElementById("txtCustomerName");
if (name.value.length < 3 || name.value.length > 15) {
window.alert("이름은 3자 이상 및 15자 이하로 입력하세요.");
name.select();
return false;
}
// 암호와 암호확인가 같은지 체크
if (pwd.value != document.getElementById("txtPasswordConfirm").value) {
window.alert("암호가 틀렸습니다.");
pwd.select();
document.getElementById("txtPasswordConfirm").value = "";
return false;
}
}
// 아이디 체크 페이지 열기
function CheckID() {
window.open("CheckID.htm", "chk", "width=300, height=100");
}