Advertisement
Guest User

Untitled

a guest
Mar 29th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. <form method="POST" id="form1" action="target.php">
  2. ...
  3. <input type="submit" name="submit" value="Submit"/>
  4. </form>
  5.  
  6. function validateForm()
  7. {
  8. var x=document.forms["myForm"]["fname"].value;
  9. if (x==null || x=="")
  10. {
  11. alert("First name must be filled out");
  12. return false;
  13. }
  14. }
  15.  
  16. <form name="myForm" action="demo_form.asp" onsubmit="return validateForm()" method="post">
  17. First name: <input type="text" name="fname">
  18. <input type="submit" value="Submit">
  19. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement