Log in

View Full Version : Click then get a new picture



Jack12
03-14-2009, 01:10 PM
Hey everyone i want to get some html code so that when i click a picture it changes into another picture and when you click it again it returns to the first picture and the loop starts over again..

Like this..

This is the picture you start with..
http://tbn3.google.com/images?q=tbn:flrjig-qfoXt_M:http://www.blackstardojo.org/shop/images/Pokeball.gif

Then when you click the first picture it changes into this..
http://tbn0.google.com/images?q=tbn:jQFsbERt4slGyM:http://homepage3.nifty.com/kuma~s-world/pokemonicon/drowzee.gif

then i want to get it so you can click it again and it changes back into the first picture and you can repeat the whole process again if you wanted it to




please help?

magicyte
03-14-2009, 05:54 PM
You can do this with javascript. This way is messy, but it's inline so that you don't have too much trouble if you don't know what javascript is.


<img src="http://tbn3.google.com/images?q=tbn:flrjig-qfoXt_M:http://www.blackstardojo.org/shop/images/Pokeball.gif" onclick="if(this.src=='http://tbn3.google.com/images?q=tbn:flrjig-qfoXt_M:http://www.blackstardojo.org/shop/images/Pokeball.gif') { this.src = 'http://tbn0.google.com/images?q=tbn:jQFsbERt4slGyM:http://homepage3.nifty.com/kuma~s-world/pokemonicon/drowzee.gif'; } else { this.src = 'http://tbn3.google.com/images?q=tbn:flrjig-qfoXt_M:http://www.blackstardojo.org/shop/images/Pokeball.gif'; }">

Jack12
03-14-2009, 06:18 PM
Thankyou this is exactly what i wanted.