Silde show of images In JSP

In order to perform this, first create a folder in your project where you store your images to be used in the slideshow. Here the folder is 'newFolder'.

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">

var slide = new Array() //array to load the images
slide[0] = new Image()
slide[0].src = "newFolder/image1.jpg"
slide[1] = new Image()
slide[1].src = "newFolder/image2.jpg"
slide[2] = new Image()
slide[2].src = "newFolder/image3.jpg"

</script>
</head>
<body>
    <img id="slide" src="newFolder/image1.jpg"   align="center" alt="Image not found">
<script type="text/javascript">
var step=0
function slideimages()
{
if (step<2)
        step++;
    else
        step=0;
 setTimeout("slideimages()",1000);  //function is called again in 1 second
}
slideimages();
</script>
</body>
</html>

Happy coding  :)

Comments

Popular posts from this blog

Compression ratio, Compression factor, saving percentage in C++

Working with database in Vb.net