Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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 09:06 PM.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    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/

  • #3
    New to the CF scene
    Join Date
    Apr 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •