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>
                width: 359px;
                position: absolute;

        width: 359px;
        height: 310px;
        margin-top: 0px;
        margin-right: 0px;
        margin-bottom: 0px;
        margin-left: 10px;                                              

<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 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>


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"
<html xmlns="http://www.w3.org/1999/xhtml">
<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)
alert("your username must be atelast six characters");
return returnValue;

<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 class="label"><label for="txtPassword">password:</td></label></div>
<div class="formElement">
<input type="password" name="txtPassword" id="txtPassword" size="12" />
<div class="formElement"><input type="submit" value="login" /></div>

Recommended Answers

All 3 Replies

JSP stand for Java Server Pages not JavaScript. Post moved

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.

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 :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.