-1

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

<!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"><head>

 <title>image slide</title>
  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
 <style type=text/css>
.fade-box 
{
                width: 359px;
                position: absolute;
                text-align:center;
   }

 #image-container 
{
        width: 359px;
        height: 310px;
        background-position:center;
        background-repeat:no-repeat;
                border-style:solid;
                border-width:5px;
                border-color:#c2cd23;
        margin-top: 0px;
        margin-right: 0px;
        margin-bottom: 0px;
        margin-left: 10px;                                              
}

</style>                        
 
</head>
<body>
<div id="image-container">
<div style="display: none;" class="fade-box" id="image-1">
<a href="javascript:GoNext();"><img src="Creek.jpg" alt="creek image" width="359" border="0" height="310"></a>
  </div>

   <div style="" class="fade-box" id="image-2">
     <a href="javascript:GoNext();"><img src="Forest.jpg" alt="forest image" width="359" border="0" height="310"></a>
              </div>

</div>
</body>
</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

<!DOcTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>first java script example</title>
<meta http-equiv="content-type"  content="text/html; charset=ISO-8859-1" />

<script type="text/javascript">

function validate(form)
{
var returnValue=true;
var username=frmRegister.txtUserName.value;
var password1=frmRegister.txtPassword1.value;
var password2=frmRegister.txtPassword2.value;
if(username.length < 6)
{
returnValue=false;
alert("your username must be atelast six characters");
frmRegister.txtUserName.focus();
}
return returnValue;
}
</script>

<body>
<form name="frmRegister" method="post" action="register.aspx" onsubmit="return validate(this);">

<div class="label"><label for="txtUsername">username:</label></div>
<div class="formElement">
<input type="text" name="txtUsername" id="txtUserName" size="12" />

</div>

<div class="label"><label for="txtPassword">password:</td></label></div>
<div class="formElement">
<input type="password" name="txtPassword" id="txtPassword" size="12" />
</div>
<div class="formElement"><input type="submit" value="login" /></div>
</form>
</body>
</html>

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

4
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by grungy coder
0

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.

0

basically the code is just like this:

<img src="Creek.jpg" alt="creek image" width="359" border="0" height="310" onclick="changeImage(this)"/>

this is the javascript code

function changeImage(obj){
      obj.src = 'the path of your new image here';
}

hope that you did understand this code :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.