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
    Oct 2008
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Changing image with onclick

    Hey there,

    I am not very into the javascript programming, so I cant make this (simple) thing work...

    suppose there are two images, img1 and img2, when img1 is clicked on it must change to img1clicked, after that when img2 is clicked on it must change to img2clicked AND img1clicked must change back to img1.

    I cant make that last thing work... fitst clicking and after that clicking img2 both images will change to the right images.

    Iwan

  • #2
    New Coder
    Join Date
    Nov 2005
    Posts
    23
    Thanks
    0
    Thanked 1 Time in 1 Post
    hi
    i am asking a similar question-ish but at least the image swap bit is working.

    if your image 1 has an id="img1" and image 2 id="img2".

    then in the img src="folder/img1.jpg" id="img1" onClick="this.src='folder/img1clicked.jpg'"

    img 2: img src="folder/img2.jpg" id="img2" onClick="this.src='folder/img2clicked.jpg';img1.src='folder/img1.jpg'"

    i think. i can't do javascript either. but it might work. fiddle with it.
    tom

  • Users who have thanked edmonds for this post:

    Iwan151 (10-02-2008)

  • #3
    New to the CF scene
    Join Date
    Oct 2008
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hey,

    I just tried it, and it is perfect for the purpose i had in mind!!

    thank you very much


  •  

    Posting Permissions

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