Changing Image and Link on Button Click
I am sure this is a pretty simple problem but for the life of me I can't get it to work.
I am setting up a page where there is a main graphic (which is a unique link) and three buttons to the side. On clicking the buttons, the graphic should change (and consequently the link).
Clicking the buttons should therefore change both the image as well as the link. I understand the notion of changing the image source but would appreciate some feedback. I would also like my graphics to change in a cool manner if possible so any feedback is appreciated.
This seems like a simple problem so I didn't paste any code -- if that would be helpful, I would be more than happy to.
JS noob btw.
here's one way of doing it:
<a id="thelink" href="http://www.google.com"><img id="thepic" src="http://upload.wikimedia.org/wikipedia/commons/d/de/Nokota_Horses_cropped.jpg"/></a>
<input type="button" onclick="changePic(1)" value="one"/>
<input type="button" onclick="changePic(2)" value="two"/>
<input type="button" onclick="changePic(3)" value="three"/>
hope that helps
Very Helpful -- thanks a lot
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)