sdy
......@@ -4,7 +4,7 @@
<title>KHU KHU Chat</title>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
<script src="validation.js"></script>
</head>
<body>
......
......@@ -4,7 +4,7 @@
<title>KHU KHU Chat</title>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
<script src="validation.js"></script>
</head>
<body>
......@@ -24,18 +24,22 @@
<div id="article">
<h2>회원가입</h2>
<div id="inputset">
<form class="signinform" action="loginmain.html">
<form class="signinform" action="loginmain.html" onsubmit="return checkValidation()" method="post">
<label for="email">이메일:</label><br>
<input type="text" name="email" placeholder="이메일을 입력하세요."><br>
<input id="eValidation"type="text" name="email" placeholder="이메일을 입력하세요." required><br>
<label for="password">비밀번호:</label><br>
<input type="password" name="password" placeholder="비밀번호를 입력하세요."><br>
<input id="fValidation" type="password" name="password" placeholder="비밀번호를 입력하세요." required><br>
<label for="password">비밀번호 확인:</label><br>
<input id="sValidation" type="password" name="checkpassword" placeholder="비밀번호를 입력하세요." required><br>
<label for="name">이름:</label><br>
<input type="text" name="name"placeholder="이름을 입력하세요."><br>
<input type="text" name="name"placeholder="이름을 입력하세요." required><br>
<label for="age">나이:</label><br>
<input type="text" name="age" placeholder="나이를 입력하세요."><br><br>
<input type="text" name="age" placeholder="나이를 입력하세요." required><br><br>
<label for="sex">성별:</label><br>
<input type="radio" value="man" name="sex">남자<br>
......
var Email={
checkEmail:function(self){
var email=document.getElementById('eValidation').value;
var regExp = /^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*.[a-zA-Z]{2,3}$/i;
if(regExp.test(email)){
return true;
}else if(email===NULL){
alert("이메일을 입력해주세요!");
return false;
}
else {
alert("이메일 형식을 제대로 입력해주세요!");
return false;
}
}
}
var Password={
checkPassword:function(self){
var fpassword=document.getElementById('fValidation').value;
var spassword= document.getElementById('sValidation').value;
if(fpassword===spassword){
return true;
}else if(fpassword===NULL || spassword===NULL){
alert("비밀번호를 입력해주세요!");
return false;
}else {
alert("작성한 비밀번호들이 다릅니다!");
return false;
}
}
}
function checkValidation(self){
Email.checkmail();
Password.checkPassword();
if(Email.checkEmail() && Password.checkPassword() ){
return true;
}else return false;
}