Advertisement
Guest User

Untitled

a guest
Aug 15th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2.    
  3. <head>
  4.        
  5.         <script type="text/javascript">
  6.        
  7.             function formchecker(){
  8.                
  9.                 var check1 = document.getElementById(username123);
  10.                 var alphaExp = /^[0-9a-zA-Z]+$/;
  11.                
  12.                 if(check1(alphaExp)){
  13.                     passwordChecker()
  14.                 }else{
  15.                     var check2 = document.getElementById(errormessage1).innerHTML = "invalid username. You can only use numbers and letters";
  16.                     return false;
  17.                    
  18.                    
  19.                 }
  20.             }
  21.            
  22.             function passwordChecker(){
  23.                 var passcheck = document.getElementById(password123);
  24.                 var confirmcheck = document.getElementById(password2);
  25.                 if(passcheck !== confirmcheck){
  26.                    
  27.                     document.getElemetnById(errormessage2).innerHTML = "Passwords do not Match. Try again";
  28.                
  29.                 }
  30.             }
  31.            
  32.         </script>
  33.  
  34.  
  35. <style type = "text/css">
  36.        
  37.             #scotty{
  38.     position:absolute;
  39.     left: 246px;
  40.     top: 256px;            
  41.                
  42.                 }
  43.        
  44.         </style>
  45.  
  46.     </head>
  47.  
  48.     <body>
  49.  
  50.         <h1>Register</h1>
  51.  
  52.         <p id="demo"></p>
  53.  
  54.  
  55.         <form name= "login" method="POST" action="">
  56.      <p>Username:
  57.         <input type ="text" name= "username" size = "15" maxlength = "25" value = "" id="username123"/>
  58.      </p>
  59.      <p> Password:
  60.         <input type = "password" name= "password" size = "15" maxlength = "20" value= "" id = "password123"/>
  61.      </p>  
  62.      <p> Confirm Password:
  63.         <input type ="password" name= "passwordconfirm" size = "15" maxlength = "20" value= "" id = "password2"/>
  64.      </p>
  65.         <button onClick= "formchecker()">Register</button>
  66.      
  67.      
  68.         </form>
  69.        
  70.        
  71.         <p id = "errormessage1">Hi</p>
  72.         <p id = "errormessage2">Hi</p>
  73.      
  74.  
  75.  
  76. </body>
  77. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement