Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. <img id="img" src="cat.jpg" />​
  2.  
  3. $('#img').toggle(
  4. function(){
  5. $(this).attr('src', 'dog.jpg');
  6. },
  7. function(){
  8. $(this).attr('src', 'cat.jpg');
  9. }
  10. );​
  11.  
  12. var images = ["hackanm.gif", "compman.gif"];
  13. var index = 0;
  14.  
  15. function changeSrc() {
  16. document.getElementById("myImage").src = images[index];
  17. index = (index + 1) % images.length;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement