A slide show with JavaScript using Frames - Page 2

Previous Tutorial:Image Slide Show
Next Tutorial: New Image Everytime You Visit the Page

In our slide show, we have a function that moves the pages forwards in the sequence. It is called showPage(). Here it is:

var thisPage=0

function showPage()

{

/*Four conditions are addressed:

The page is the first page

The page is the second from last page.

The page is the last page

The page is some other page in the sequence (Regular page).

*/

if (thisPage==0){

document.form1.textPrevious.value= URLText[0]

document.form1.textNext.value=URLText[2]

parent.frames[0].location.href = URLList[1];

thisPage=thisPage+1;

loc=loc+1

}

else

if(thisPage==numurls-2){

document.form1.textPrevious.value= URLText[thisPage]

document.form1.textNext.value='End of series'

parent.frames[0].location.href = URLList[thisPage+1];

thisPage=numurls-1

}

else

if (thisPage==numurls-1){

alert('End of series')

}

else {

document.form1.textPrevious.value= URLText[thisPage]

document.form1.textNext.value=URLText[thisPage+2]

parent.frames[0].location.href = URLList[thisPage+1];

thisPage=thisPage+1;

loc=loc+1;

}

}

 

javaScriptBible.gif (13558 bytes)The book I use most often as a reference is Danny Goodman's JavaScript Bible. It is the book I would recommend to all serious students of Java Script. You can find out more about the book by clicking on the picture on the right and checking it out at Amazon.com!

Or here for Amazon.co.uk for UK and Europe.

Also, check out the recommended books and software page.

 


Ken Ward's HTML Guide...

 


[If you need to learn more about HTML visit the HTML Tutorial]

To ask questions, make comments, etc,
use the mailing list

I am always pleased to hear from you.
To ask questions, make comments, etc,
use the mailing list : Click here to join 1stJavaScript