[Typo3-dev] Javascript me please!

Lasse Nørby zamiams at hotmail.com
Sun Sep 4 16:36:28 CEST 2005


Hmm.. Very sorry..
I searched google, and got a lot of hits, but no answer. Maybe I used 
the wrong words eh?
Anyways thank you very much for your answer! Will see if I'm wise enough 
to make any sense of it..
Have a nice day ;)

Kraft Bernhard wrote:
> 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




More information about the TYPO3-dev mailing list