MilkyTech
03-01-2011, 07:17 PM
Not sure if I worded the subject correctly but I would like to have the onclick for a particular element swap out an image and then a second click on the same element brings back the original image and a third click swaps to the second image again and a 4th click bring back the original, and so on.
In other words: swap back and forth between 2 images each time you click on the same element.
I have this code to switch to the second image:
onclick="document.getElementById('origImage').src='2ndImage.png';"
now I want to be able to click again and go back to the orig image.
In other words: swap back and forth between 2 images each time you click on the same element.
I have this code to switch to the second image:
onclick="document.getElementById('origImage').src='2ndImage.png';"
now I want to be able to click again and go back to the orig image.