Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script type="text/javascript">
- function formchecker(){
- var check1 = document.getElementById(username123);
- var alphaExp = /^[0-9a-zA-Z]+$/;
- if(check1(alphaExp)){
- passwordChecker()
- }else{
- var check2 = document.getElementById(errormessage1).innerHTML = "invalid username. You can only use numbers and letters";
- return false;
- }
- }
- function passwordChecker(){
- var passcheck = document.getElementById(password123);
- var confirmcheck = document.getElementById(password2);
- if(passcheck !== confirmcheck){
- document.getElemetnById(errormessage2).innerHTML = "Passwords do not Match. Try again";
- }
- }
- </script>
- <style type = "text/css">
- #scotty{
- position:absolute;
- left: 246px;
- top: 256px;
- }
- </style>
- </head>
- <body>
- <h1>Register</h1>
- <p id="demo"></p>
- <form name= "login" method="POST" action="">
- <p>Username:
- <input type ="text" name= "username" size = "15" maxlength = "25" value = "" id="username123"/>
- </p>
- <p> Password:
- <input type = "password" name= "password" size = "15" maxlength = "20" value= "" id = "password123"/>
- </p>
- <p> Confirm Password:
- <input type ="password" name= "passwordconfirm" size = "15" maxlength = "20" value= "" id = "password2"/>
- </p>
- <button onClick= "formchecker()">Register</button>
- </form>
- <p id = "errormessage1">Hi</p>
- <p id = "errormessage2">Hi</p>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement