Search Topic Here

Monday, 25 May 2015

Simple Javascrip codet for images Slideshow


The below code is used to slide the images .



<!DOCTYPE html>
<head>
<script type="text/javascript">
var imgIndex = 0;
var index = 0;
var imgArray = ["http://www.wonderslist.com/wp-content/uploads/2013/01/Most-Beautiful-Flowers.jpg","http://nailartsdesign.com/wp-content/uploads/2015/04/Beautiful-Flowers-Images-2.jpg","http://webneel.com/wallpaper/sites/default/files/images/01-2014/35-flower-wallpapers.preview.jpg","http://fc04.deviantart.net/fs16/f/2007/127/2/d/Wallpaper_Request_by_Finvara.jpg"];


var timer = 0;




function showImgs(){
document.getElementById("imgId").src = imgArray[imgIndex];
imgIndex++;
if(imgIndex>4){
imgIndex = 0;

}
setTimeout("showImgs()",10000);

}
</script>
</head>
<html>
<body onload="showImgs()">
<div >
<img id="imgId" src=""/>
</div>



</body>
</html>


Copy to see the Result



No comments:

Post a Comment