943,640 Members | Top Members by Rank

Ad:
Aug 8th, 2008
0

why won't this script work?

Expand Post »
Any input is appreciated.

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Untitled Document</title>
  6. <script language="text/javascript">
  7. function validateForm(form1)
  8. {
  9. alert("Please enter your name.");
  10.  
  11. }
  12. </script>
  13. </head>
  14.  
  15. <body>
  16. <form name="form1" id="form1" method="post" onSubmit="validateForm(form1);">
  17. <input type="text" id="name" name="name" />
  18. <input type="submit" name="SubmitName" value="Submit" />
  19. </form>
  20. </body>
  21. </html>
Last edited by Tekmaven; Aug 8th, 2008 at 5:33 pm. Reason: Code tags
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
Tom Tolleson is offline Offline
39 posts
since Oct 2007
Aug 9th, 2008
0

ReModified

html Syntax (Toggle Plain Text)
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  4. <title>Untitled Document</title>
javascript Syntax (Toggle Plain Text)
  1. <script type="text/javascript">
  2. <!--Begin Hiding
  3.  
  4. //I just modified your code. Pls. Take a good look.
  5.  
  6. function validateForm(form)
  7. {
  8. alert('Please enter your name.');
  9. }
  10. // Done Hiding -->
  11. </script>
html Syntax (Toggle Plain Text)
  1. </head>
  2. <body>
  3. <form name="form1" method="post" onSubmit="validateForm(this.form);">
  4. <input type="text" id="name" /> <input type="submit" name="SubmitName" value="Submit" />
  5. </form>
  6. <!-- Hope it helps you, enjoy your coding...-->
  7. </body>
  8. </html>
Featured Poster
Reputation Points: 114
Solved Threads: 138
Posting Shark
essential is offline Offline
973 posts
since Aug 2008
Aug 14th, 2008
0

Re: why won't this script work?

Yes, thank you very much!
Reputation Points: 10
Solved Threads: 0
Light Poster
Tom Tolleson is offline Offline
39 posts
since Oct 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: Getting Data From Other Sites
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Required field validation





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC