Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Form Validation</title>
- <Script type="text/javascript">
- function validate()
- {
- var flag=true;
- var username=document.getElementById("uname").value;
- if(username=null || username.length<6)
- {
- return_value=false;
- alert("your username should be of atleast of 6 characters!");
- document.getElementById("uname").value=" ";
- }
- var pwd=document.getElementById("pwd").value;
- var pwd1=document.getElementById("pwd1").value;
- if(pwd=null || pwd1.length<6)
- {
- flage=false;
- alert("your password should contain atleast of 6 characters!");
- document.getElementById("pwd").value=" ";
- document.getElementById("pwd1").value=" ";
- }
- if(pwd != pwd1)
- {
- flag=false;
- alert("your password didnot match");
- document.getElementById("pwd").value=" ";
- document.getElementById("pwd1").value=" ";
- }
- var ph=document.getElementById("pn").value;
- if(isNaN(ph))
- {
- flag="false";
- alert("only numbers in phone");
- document.getElementById("pn").value=" ";
- }
- if(flag=="false");
- return false;
- }
- </script>
- </head>
- <body bgcolor="silver">
- <form name="regform" action="THANKS.html" align="center" onsubmit="return validate()">
- NAME:          <input type="text field" name="name"></input type></br></br>
- USERNAME:<input type="text field" name="uname"></input type></br></br>
- PASSWORD:<input type="password" name="pwd"></input type><br/><br/>
- PASSWORD1:<input type="password" name="pwd1"></input type><br/><br/>
- E-MAIL ID:   <input type="text field" name="emi"></input type></br></br>
- PHONE NO:<input type="text field" name="pn"></input type></br></br>
- Date Of Birth:DD<input type="text" size=2>MM<input type="text" size=2>YY<input type="text" size=3></br></br>
- MALE<input type="radio"></input type>
- FEMALE<input type="radio"></input type></br></br>
- ENGLISH<input type="checkbox"></input type>
- HINDI<input type="checkbox"></input type>
- TELUGU<input type="checkbox"></input type>
- TAMIL<input type="checkbox"></input type></br></br>
- <p>ADDRESS:</p><textarea name="address"></textarea></p></br></br>
- <button type="submit">Submit</button>
- <button type="reset">Reset</button>
- </form>
- </body>
- </html>
Add Comment
Please, Sign In to add comment