US Missions to Mars

< Previous     Next >

<SCRIPT>

// create an Array which contains the location of the gifs
var myPix = new Array("images/pathfinder.gif", "images/surveyor.gif", "images/surveyor98.gif");
var thisPic = 0; // a counter to keep track of where we are

// this function below does the following:
// checks for browser compatibility issuse & makes sure that the counter is > 0,
// Remember that Array Index goes from 0 - 2, it can not be less than 0
// if counter, thisPic, is > 0 then decrement the counter

// & swap out myPicture with the Array element myPix[thisPic]
function processPrevious() {
     if (document.images && thisPic > 0) {
          thisPic--;
          document.myPicture.src = myPix[thisPic];
     }
}

// this function below does the following:
// checks for browser compatibility issuse & makes sure that the counter is < 2,
// Remember that Array Index goes from 0 - 2, it can not be greater than 2
// if counter, thisPic, is < 2 then increment the counter
// & swap out
myPicture with the Array element myPix[thisPic]
function processNext() {
     if (document.images && thisPic < 2) {
          thisPic++;
          document.myPicture.src = myPix[thisPic];
     }
}

</SCRIPT>

<IMG SRC="images/pathfinder.gif" NAME="myPicture">

<A HREF="javascript:processPrevious()">Previous</A>
<
A HREF="javascript:processNext()">Next</A>