Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-27-2010, 08:03 PM   PM User | #1
Raunchola
New to the CF scene

 
Join Date: Apr 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Raunchola is an unknown quantity at this point
Smile Change image by onclick?

Hello!
I'm not skilled whatsoever in javascript, and therefore I'm turning to you guys. What I'm requesting is a javascript that makes an image (of a button) change into another image when I'm clicking on it. But then, I want it to return to its original image when I'm clicking on it twice.

Now, I've already found some scripts on google that shows me how to do this, however; I'm going to use two separate buttons, and on each of these buttons this onclick-image-change-effect is going to be applied (but they'll have different images both originally and after the onclick).

So:

Button 1: Image A -> Onclick -> Image B -> Onclick -> Image A
Button 2: Image C -> Onclick -> Image D -> Onclick -> Image C

I know it sounds kinda confusing, but I'm sure you guys understand what I mean! I'd be really grateful if some friendly soul could help me out with this since I'm not so skilled in javascript at all. Thanks in advance!

Last edited by Raunchola; 04-27-2010 at 08:06 PM..
Raunchola is offline   Reply With Quote
Old 04-27-2010, 08:10 PM   PM User | #2
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
Since you posted this in the Javascript Frameworks forum, I guess you're hoping for a frameworks solution? Good choice. You can use jQuery's .toggle() effect to do this:

http://api.jquery.com/toggle/
__________________
Fumigator is offline   Reply With Quote
Old 04-27-2010, 08:15 PM   PM User | #3
Raunchola
New to the CF scene

 
Join Date: Apr 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Raunchola is an unknown quantity at this point
Quote:
Originally Posted by Fumigator View Post
Since you posted this in the Javascript Frameworks forum, I guess you're hoping for a frameworks solution? Good choice. You can use jQuery's .toggle() effect to do this:

http://api.jquery.com/toggle/
Actually I didn't really understand which forum section I was supposed to post this entry in, so therefore I put it here only by intuition.

However, I'll take a look at the link! Thanks.
Raunchola is offline   Reply With Quote
Reply

Bookmarks

Tags
buttons, javascript, onclick

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:40 AM.


Advertisement
Log in to turn off these ads.