[Javascript] accessing a form element

Günther Mittermayer g_mitter at web.de
Mon Apr 5 08:21:01 CDT 2004


Hi all,

I'm kind of stuck here.
I have an application that has a form, in which a image button must have its image swapped periodically.

My idea was to have a javascript script swapping the "src" attribute of the image button.  I have already lost a lot of time trying to have it working, but it simply doesn't. I get the following error:

Error: document.form1.image1 has no properties.

Can anyone help me finding out what's wrong?? Any help is welcome!!!!! I said ANY!

thanx in advance!!
Günther.
=======
Here is some code:

the javascript function:
function refresh_image()
{
//Refreshes the image
document.form1.image1.src="whatever.png";
setTimeout('refresh_image();',500);
}

and the form looks like this:
<form method="post" action="theaction.cgi" enctype="application/x-www-form-urlencoded" name="form1">
      <input type="image" name="image1" src="../pics/the_image.png" />
</form>
_____________________________________________________________________
Der WEB.DE Virenschutz schuetzt Ihr Postfach vor dem Wurm Netsky.A-P!
Kostenfrei fuer alle FreeMail Nutzer. http://f.web.de/?mc=021157




More information about the Javascript mailing list