[Typo3-dev] Javascript me please!
Kraft Bernhard
kraftb at gmx.net
Sun Sep 4 16:31:54 CEST 2005
You should note that this is OffTopic .... Javascript questions should go to specific
forums or newsgroups/mailinglists ... there are a log on the net ...
And I can't believe that you searched with google and didn't find a javascript which
replaces an image back and forth when it is clicked ...
but still ... here is the answer :
Lasse Nørby wrote:
> I want an IMG, expand.gif, to change to collapse.gif when the user
> clicks it, and then change back to expand.gif when clicked again.
> How do i do this?? I guess it's something like: onclick="myFunction()",
> but it's the myFunction part I can't see through.
> Please excuse my ignorence, but I am no programmer, and all I can do is
> the most basic javascripts like mouseovers etc.
Simply do the same as you do in "onMouseOver" and "onMouseOut" method in the
"onClick" method: replacing an image.
Decide which image to insert by checking the actual value of the image:
if (document....img.src=="img1.gif") {
document.....img.src = "img2.gif";
} else {
document.....img.src = "img1.gif";
}
greets,
Bernhard
--
----------------------------------------------------------------------
"Freiheit ist immer auch die Freiheit des Andersdenkenden"
Rosa Luxemburg, 1871 - 1919
----------------------------------------------------------------------
More information about the TYPO3-dev
mailing list