Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script>
- function testvalidate(event){
- console.log();
- event.preventDefault();
- var room_for_username = document.form.username.value;
- var room_for_password = document.form.password.value;
- var Confimpassword = document.form.password2.value;
- if( room_for_username == ''){
- alert("Username cannot be empty");
- return false;
- }
- if ( room_for_password == '') {
- alert("enter your choice of passowrd");
- return false;
- }
- else if(room_for_password.length < 6) {
- alert("password must be greater than 6 character");
- return false;
- }
- else if (Confimpassword == '') {
- alert("Enter the same as above password");
- }
- else if(room_for_password != Confimpassword) {
- alert("not match");
- return false;
- }
- else{
- alert("correct");
- return true;
- }
- }
- </script>
- <style type="text/css">
- body{
- display: flex;
- justify-content: center;
- align-items: center;
- }
- input{
- border-radius: 24px;
- width: 100%;
- height: 25px;
- border:1px solid transparent;
- }
- form{
- padding: 10px;
- font-size: 25px;
- background: brown;
- border-radius: 22px;
- font-style: cursive;
- }
- label{
- font-size: 25px;
- }
- .item{
- flex-direction: 'row';
- margin: 20px;
- }
- </style>
- </head>
- <body>
- <form method="post" onsubmit="testvalidate(event)" name="form">
- <div class="item">
- <label> Username </label>
- <input type="text" name="username">
- </div>
- <div class="item">
- <label> Password </label>
- <input type="password" name="password">
- </div>
- <div class="item">
- <label> Confirm Password </label>
- <input type="password" name="password2">
- </div>
- <div class="item">
- <input type="submit" name="submit" value="check me">
- </div>
- </form>
- </body>
- </html>
Add Comment
Please, Sign In to add comment