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