How to Create Slide Show using JavaScript

Leave a Comment

Slide show displays an array of images in an automated slide show, a pull down menu, or the various slide show controls which can be included, such as, previous, next or play again.

To create a slide show, import the images you want to include in the slide show. Preload the images using JavaScript. Preload, in JavaScript, refers to the loading of images into cache prior to displaying them. Preloading images is "necessary" in a slide show, since the switching between images have to be instantaneous, without any delay.

Example Code:
<html>
<head>
<script language="Javascript">
function startSlideShow()
{
setTimeout("Change1()",1000)
}
function Change1()
{
document.images.slide.src="img1.gif";
setTimeout("Change2()",1000);
}
function Change2()
{
document.images.slide.src="img2.gif";
setTimeout("Change3()",1000);
}
function Change3()
{
document.images.slide.src="img3.gif";
setTimeout("Change1()",1000);
}
</Script>
</head>
<script>
<body onload="Change1();selectScroller(0);">
<img src="img1.gif" name="slide" border="0" width="100" height="156" />
</body>
</script>
</html>

0 comments:

Post a Comment