Forum Moderators: open

Message Too Old, No Replies

onclick -> Change image -> Onclick -> Change back

rotate an image (true / false) on click...or something? :)

         

Japfreak2000

10:49 pm on Mar 24, 2003 (gmt 0)

10+ Year Member



This might be very easy for the people who know javascript but I'm not one of them.... All I want to do is change the image in this script:

[dansteinman.com...]

I want another image when the menue is expanded. and I want it to change back again when it's not expanded anymore. Maybe someone can help?

thanks
/JESPER

tedster

4:46 pm on Mar 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld Jesper,

On a quick look, the answer is probably no, it's not all that easy to make the change. That's a pretty sophisiticated bit of DHTML.

If you're not able to wade into learning JavaScript and CSS yourself at this moment, you should probably think of hiring a developer to help you make the change you want. Probably not too many hours, but also not a simple tweak, given the number of seperate script files involved.

I agree, it would be a nice enhancment.

WibbleWobble

5:02 pm on Mar 25, 2003 (gmt 0)

10+ Year Member



I think I've a piece of Javascript code lying around at home that'll do this (the same one I promised to find in another thread, which I've yet to do, doh!).
Assuming I still have it, I'll make sure it works and whatnot before posting it.

(It is actually quite a simple piece of Javascript, though it is dependent on css attributes and getelementbyID. Still, it worked for my purposes, should do with yours)

DrDoc

5:04 pm on Mar 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's actually not too hard. I've done similar things before. True, it takes some tweaking, but it could be done in about half an hour. The number of scripts shouldn't make it any more complicated either.

I posted a similar (but simplified) example in the CSS forum the other day - CSS powered sitemaps [webmasterworld.com]

Japfreak2000

7:12 pm on Mar 25, 2003 (gmt 0)

10+ Year Member



img1 = "arrow_right.gif";
img2 = "arrow_down.gif";
function chng(c_img) {
if (document[c_img].src.indexOf(img1)!= -1) document[c_img].src = img2;
else document[c_img].src = img1;
}

<a href="javascript:chng('img');"><img src="arrow_right.gif" name="img"></a>

it was as simple as this :)

Japfreak2000

7:13 pm on Mar 25, 2003 (gmt 0)

10+ Year Member



Thanks anyway for all the answers :)

WibbleWobble

7:24 pm on Mar 25, 2003 (gmt 0)

10+ Year Member



Good job too, as looking at the code I have, I couldn't figure it out ;)