Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. var arrayImages = new Array('images/naruto shippuuden characters.jpg','images/Yondaime.jpg', 'images/gaara.jpg', 'images/akatsuki.jpg');
  2. var thisPic = 0;
  3. var time_is_on
  4.  
  5. function initLinks() {
  6. document.getElementById("nextLink").onclick = processNext;
  7. document.getElementById("backLink").onclick = processBack;
  8. document.getElementById("playLink").onclick = processPlay;
  9. }
  10.  
  11. function processNext() {
  12. thisPic++;
  13. if (thisPic == arrayImages.length) {
  14. thisPic = 0;
  15. }
  16.  
  17. document.getElementById("myPicture").src = arrayImages[thisPic];
  18. return false;
  19. }
  20.  
  21. function processBack() {
  22. thisPic--;
  23. if (thisPic <=-1) {
  24. thisPic = arrayImages.length-1;
  25. }
  26.  
  27. document.getElementById("myPicture").src = arrayImages[thisPic];
  28. return false;
  29. }
  30.  
  31. function processPlay() {
  32.  
  33. if (!time_is_on) {
  34. timer_is_on=1;
  35. goNext();
  36. }
  37. return false;
  38. }
  39.  
  40. function goNext() {
  41. processNext();
  42. t=setTimeout("goNext()", 2000);
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement