daily pastebin goal
50%
SHARE
TWEET

Untitled

a guest Apr 21st, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <head>
  3. <title>Form Validation</title>
  4. <Script type="text/javascript">
  5. function validate()
  6. {
  7. var flag=true;
  8. var username=document.getElementById("uname").value;
  9.  
  10. if(username=null || username.length<6)
  11. {
  12. return_value=false;
  13. alert("your username should be of atleast of 6 characters!");
  14. document.getElementById("uname").value="  ";
  15. }
  16. var pwd=document.getElementById("pwd").value;
  17. var pwd1=document.getElementById("pwd1").value;
  18. if(pwd=null || pwd1.length<6)
  19. {
  20. flage=false;
  21. alert("your password should contain atleast of 6 characters!");
  22. document.getElementById("pwd").value="  ";
  23. document.getElementById("pwd1").value="  ";
  24. }
  25. if(pwd != pwd1)
  26. {
  27. flag=false;
  28. alert("your password didnot match");
  29. document.getElementById("pwd").value="  ";
  30. document.getElementById("pwd1").value="  ";
  31. }
  32. var ph=document.getElementById("pn").value;
  33. if(isNaN(ph))
  34. {
  35. flag="false";
  36. alert("only numbers in phone");
  37. document.getElementById("pn").value="  ";
  38. }
  39. if(flag=="false");
  40. return false;
  41. }
  42. </script>
  43. </head>
  44. <body bgcolor="silver">
  45. <form name="regform" action="THANKS.html" align="center" onsubmit="return validate()">
  46. NAME:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text field" name="name"></input type></br></br>
  47. USERNAME:<input type="text field" name="uname"></input type></br></br>
  48. PASSWORD:<input type="password" name="pwd"></input type><br/><br/>
  49. PASSWORD1:<input type="password" name="pwd1"></input type><br/><br/>
  50. E-MAIL ID: &nbsp    <input type="text field" name="emi"></input type></br></br>
  51. PHONE NO:<input type="text field" name="pn"></input type></br></br>
  52. Date Of Birth:DD<input type="text" size=2>MM<input type="text" size=2>YY<input type="text" size=3></br></br>
  53. MALE<input type="radio"></input type>
  54. FEMALE<input type="radio"></input type></br></br>
  55. ENGLISH<input type="checkbox"></input type>
  56. HINDI<input type="checkbox"></input type>
  57. TELUGU<input type="checkbox"></input type>
  58. TAMIL<input type="checkbox"></input type></br></br>
  59. <p>ADDRESS:</p><textarea name="address"></textarea></p></br></br>
  60. <button type="submit">Submit</button>
  61. <button type="reset">Reset</button>
  62. </form>
  63. </body>
  64.  
  65. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top