Advertisement
niro0711

login

Jan 24th, 2019
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!doctype html>
  2. <html>
  3.  
  4.     <head>
  5.         <title>Login</title>
  6.     </head>
  7.  
  8.    
  9.     <body bgcolor="mediumaquamarine" id="theBody">
  10.            
  11.             <center>
  12.            
  13.                 <h1>My Login System</h1>
  14.                
  15.                 <hr />
  16.                
  17.                 <label for="user">username:</label>
  18.                
  19.                 <input type="text" id="user" />
  20.                
  21.                 <br/><br/>
  22.                
  23.                 <label for="pass">password:</label>
  24.                
  25.                 <input type="password" id="pass" />
  26.                
  27.                 <br/><br/>
  28.                
  29.                 <input type="button"  value="login" onclick="loginClicked()" />
  30.                 <input type="button"  value="reset" onclick="resetClicked()" />
  31.            
  32.            
  33.             </center>
  34.            
  35.         <script>
  36.        
  37.        
  38.        
  39.        
  40.             // function to check the login info that the user entered
  41.             function loginClicked(){
  42.            
  43.                 //theBody.innerHTML += "<br/>the body"; // we can get the entire body and change it was well using the id
  44.            
  45.                 var username = user.value; // saving the text we have in the username textbox
  46.                 var password = pass.value; // saving the text we have in the password textbox
  47.                
  48.                
  49.                 var myUsername = "Jane";
  50.                 var myPassword = "123";
  51.                
  52.                 if(username == myUsername && password == myPassword){
  53.                
  54.                     alert("welcome!");
  55.                    
  56.                 }
  57.                 else{
  58.                     alert("we don't want you here");
  59.                 }
  60.  
  61.            
  62.             }
  63.            
  64.             // function to reset the textboxes
  65.             function resetClicked(){
  66.            
  67.                 // to empty the textboxes we change the 'value' parameter to an empty string ("")
  68.                 user.value = "";
  69.                 pass.value = "";
  70.            
  71.             }
  72.                
  73.        
  74.  
  75.         </script>
  76.     </body>
  77.  
  78. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement