본문으로 바로가기

ID PASSWORD 체크

category 프로그래밍 2017. 12. 11. 20:58



초기화면



아이디가:abc

비밀번호가:cde일때 



만약 비밀번호가 일치하지않을때


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<style>
    .form{
        padding: 200px;
    }
    .design{
        position: relative;
          background: #FFFFFF;
         padding: 35px;
          text-align: center;
        box-shadow: 0 0 0px 0 rgba(0, 0, 0, 0.2), 0 0px 10px 0 rgba(0, 0, 0, 0.24);
    }
</style>
    <title>ID PASSWORD</title>
<script>
    function show(){
 
        var id=document.loginForm.myId.value;
 
        var pwd=document.loginForm.myPwd.value;
 
    if(id==""){
 
        window.alert("아이디를 입력해주세요.");
 
        document.loginForm.myId.focus();
 
    return;
 
    }else if(pwd==""){
 
        window.alert("비밀번호를 입력해주세요.");
 
        document.loginForm.myPwd.focus();
    return;
    }else if(id=="abc" && pwd=="cde"){
        document.getElementById('result').innerHTML="당신이름은 : "+id+"이고 비밀번호 : "+pwd+"입니다"
    return;
    }
    else{
        document.getElementById('result').innerHTML="아이디 또는 비밀번호를 다시 확인하세요.<br>등록되지 않은 아이디이거나, 아이디 또는 비밀번호를 잘못 입력하셨습니다."
    }
    }
</script>
 
</head>
 
<body>
<div class="form">
  <div class="container" id="wrap">
  <div class="row">
  <div class="col-md-6 col-md-offset-3">             
  <form name="loginForm" class="design" role="form">
 
    <h2>아이디와 암호를 입력하시오.</h2>
 
     <input type="id" id="myId" name="text" class="form-control input-lg" placeholder="ID" ng-model="user.id" ng-required="true">
<br>
    <input type="password" id="myPwd" name="text" class="form-control input-lg" placeholder="Password" ng-model="user.password" ng-required="true">
<br>
    <button class="btn btn-lg btn-primary btn-block signup-btn" type="button" id="msg" value="로그인" onclick="show()" >암호를 입력하세요</button>
    <button class="btn btn-lg btn-primary btn-block signup-btn" type="reset" id="msg" value="다시하기" >다시하기</button>
<br>
<br>
    <div id="result">
        
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>
 
cs

소스코드


'프로그래밍' 카테고리의 다른 글

Merry Christmas  (0) 2017.12.24