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