|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | +<head> |
| 4 | + <meta charset="utf-8" /> |
| 5 | + <title>page</title> |
| 6 | + <link rel="stylesheet" type="text/css" href="main.css"> |
| 7 | + <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css"> |
| 8 | + <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> |
| 9 | + <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script> |
| 10 | + <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 11 | + <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> |
| 12 | + <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> |
| 13 | + <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script> |
| 14 | + <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> |
| 15 | + |
| 16 | +</head> |
| 17 | +<body> |
| 18 | + |
| 19 | + <div class="container mt-5 border p-3"> |
| 20 | + <h2 class="title text-center">LOGIN SYSTEM</h2> |
| 21 | + <input type="text" id="username" class=" my-2 form-control text-center" placeholder="USERNAME"> |
| 22 | + <input type="password" id="password" class=" my-2 form-control text-center" placeholder="PASSWORD"> |
| 23 | + <button id="but" class="btn btn-danger btn-block">LOGIN</button> |
| 24 | + <div id="result" class="form-block text-center mt-4"></div> |
| 25 | + </div> |
| 26 | + |
| 27 | + <script> |
| 28 | + |
| 29 | + $(document).ready(function(){ |
| 30 | + |
| 31 | + $("#but").click(function(){ |
| 32 | + |
| 33 | + let username = $("#username").val(), |
| 34 | + password = $("#password").val(); |
| 35 | + |
| 36 | + const setPromise = new Promise(function(resolve,reject){ |
| 37 | + if(username == "truecodes" && password == "codeblogger"){ |
| 38 | + resolve("Welcome " + username ); |
| 39 | + }else{ |
| 40 | + reject("Check your username and password again.") |
| 41 | + } |
| 42 | + }) |
| 43 | + |
| 44 | + setPromise.then(function(message){ |
| 45 | + alert(message); |
| 46 | + }).catch(function(a){ |
| 47 | + alert(a) |
| 48 | + }) |
| 49 | + }) |
| 50 | + |
| 51 | + }) |
| 52 | + |
| 53 | + |
| 54 | + </script> |
| 55 | + |
| 56 | +</body> |
| 57 | +</html> |
0 commit comments