943,106 Members | Top Members by Rank

Ad:
Feb 9th, 2010
-1

image slide & form validation

Expand Post »
Hi,

1.I want to change the image when the user click's over the image

i'm getting error.. "error:javascript:gonext();" like this is status bar
can any one solve me pls>>
suggest some code to change the image when user clicks

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">
  2. <html xmlns="http://www.w3.org/1999/xhtml"><head>
  3.  
  4. <title>image slide</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
  6. <style type=text/css>
  7. .fade-box
  8. {
  9. width: 359px;
  10. position: absolute;
  11. text-align:center;
  12. }
  13.  
  14. #image-container
  15. {
  16. width: 359px;
  17. height: 310px;
  18. background-position:center;
  19. background-repeat:no-repeat;
  20. border-style:solid;
  21. border-width:5px;
  22. border-color:#c2cd23;
  23. margin-top: 0px;
  24. margin-right: 0px;
  25. margin-bottom: 0px;
  26. margin-left: 10px;
  27. }
  28.  
  29. </style>
  30.  
  31. </head>
  32. <body>
  33. <div id="image-container">
  34. <div style="display: none;" class="fade-box" id="image-1">
  35. <a href="javascript:GoNext();"><img src="Creek.jpg" alt="creek image" width="359" border="0" height="310"></a>
  36. </div>
  37.  
  38. <div style="" class="fade-box" id="image-2">
  39. <a href="javascript:GoNext();"><img src="Forest.jpg" alt="forest image" width="359" border="0" height="310"></a>
  40. </div>
  41.  
  42. </div>
  43. </body>
  44. </html>


2. if action=registration.aspx is specified i'm getting error..cannot find the path name???? how to validae the form??? how to handle this registraion.aspx???how to use this to validate form

html Syntax (Toggle Plain Text)
  1. <!DOcTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2. "http://www.w3.org/TR/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <title>first java script example</title>
  6. <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
  7.  
  8. <script type="text/javascript">
  9.  
  10. function validate(form)
  11. {
  12. var returnValue=true;
  13. var username=frmRegister.txtUserName.value;
  14. var password1=frmRegister.txtPassword1.value;
  15. var password2=frmRegister.txtPassword2.value;
  16. if(username.length < 6)
  17. {
  18. returnValue=false;
  19. alert("your username must be atelast six characters");
  20. frmRegister.txtUserName.focus();
  21. }
  22. return returnValue;
  23. }
  24. </script>
  25.  
  26. <body>
  27. <form name="frmRegister" method="post" action="register.aspx" onsubmit="return validate(this);">
  28.  
  29. <div class="label"><label for="txtUsername">username:</label></div>
  30. <div class="formElement">
  31. <input type="text" name="txtUsername" id="txtUserName" size="12" />
  32.  
  33. </div>
  34.  
  35. <div class="label"><label for="txtPassword">password:</td></label></div>
  36. <div class="formElement">
  37. <input type="password" name="txtPassword" id="txtPassword" size="12" />
  38. </div>
  39. <div class="formElement"><input type="submit" value="login" /></div>
  40. </form>
  41. </body>
  42. </html>
Last edited by peter_budo; Feb 9th, 2010 at 3:22 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ausmaya is offline Offline
14 posts
since Feb 2010
Feb 9th, 2010
0
Re: image slide & form validation
JSP stand for Java Server Pages not JavaScript. Post moved
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 871
Code tags enforcer
peter_budo is offline Offline
6,649 posts
since Dec 2004
Feb 10th, 2010
0
Re: image slide & form validation
Just by reading the code I noticed that you are calling this function "GoNext()" but nowhere in the code is there such a function.

Another thing you don't need to use the "javascript:" anymore, the browser will know it is a javascript function that you are referring to.
Reputation Points: 36
Solved Threads: 57
Posting Whiz
Thirusha is offline Offline
355 posts
since Mar 2008
Feb 11th, 2010
0
Re: image slide & form validation
basically the code is just like this:

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <img src="Creek.jpg" alt="creek image" width="359" border="0" height="310" onclick="changeImage(this)"/>

this is the javascript code
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. function changeImage(obj){
  2. obj.src = 'the path of your new image here';
  3. }

hope that you did understand this code
Reputation Points: 10
Solved Threads: 0
Newbie Poster
grungy coder is offline Offline
7 posts
since Feb 2010

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: Javascript form validation
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: how to disable savepage as in file menu?





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


Follow us on Twitter


© 2011 DaniWeb® LLC