Please login or register. Welcome to the Studio, guest!


Quick Links:


newBookmarkLockedFalling

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
Just the basics, but hey, someone could find it helpful. :P

<script>
// Slide Show by CD of Studio Zero (http://studiozero.proboards44.com/)

// This is the number of seconds before the image's switch.
var timeSet = 3;

/* Add a new line and raise the number by one for each new image.*/var imaShow = new Array();
imaShow[0] = "First Image URL";
imaShow[1] = "Second Image URL";

document.write("<center><img src='"+imaShow[0]+"' border='0' id='currentImage' alt='Image 0' /><br /><a href='javascript:void(0);' onclick='prevImg();'>Previous</a> | <a href='javascript:void(0);' onclick='pauseImg();'>Pause</a> | <a href='javascript:void(0);' onclick='nextImg();'>Next</a></center>");

var realTime = parseInt(timeSet*1000);

intCreate = setInterval("nextImg()",realTime);
var ImgFor = document.getElementById("currentImage");
var running = true;

function nextImg(){
  if(running){
     clearInterval(intCreate);
  }
  var curPlace = parseInt(ImgFor.alt.split("Image ")[1]);
  curPlace++;

  if(curPlace >= imaShow.length){
     curPlace = 0;
  }

  ImgFor.src = imaShow[curPlace];
  ImgFor.alt = "Image "+curPlace;
  if(running){
     intCreate = setInterval("nextImg()",realTime);
  }
}

function prevImg(){
  if(running){
     clearInterval(intCreate);
  }
  var curPlace = parseInt(ImgFor.alt.split("Image ")[1]);
  curPlace--;

  if(curPlace < 0){
     curPlace = imaShow.length-1;
  }

  ImgFor.src = imaShow[curPlace];
  ImgFor.alt = "Image "+curPlace;
  if(running){
     intCreate = setInterval("nextImg()",realTime);
  }
}

function pauseImg(){
  if(running){
     clearInterval(intCreate);
     running = false;
  } else {
     intCreate = setInterval("nextImg()",realTime);
     running = true;
  }
}

</script>



hpmad

hpmad Avatar



858


September 2005
Nice :D Could be useful for image slides for projects of something...

lonewolf

lonewolf Avatar

*
New Member

4


October 2005
Nice code,I will proably find this useful on my site. 8-)
This signature area for rent. Inquire within.

newBookmarkLockedFalling