Web Technologies
Slip3
Q.1) Write a JavaScript to create an image slider.(Use array to store images) [Marks 30]
Solution
image.html
<html><script language="JavaScript">
var i = 0;
var path = new Array();
// LIST OF IMAGES
path[0] ="G:\ab.jpg";
path[1] = "G:\h.jpg";
path[2] ="G:\ok.jpg";
function swapImage()
{
document.slide.src = path[i];
if(i < path.length - 1) i++; else i = 0;
setTimeout("swapImage()",1000);
}
window.onload=swapImage;
</script>
<img height="200" name="slide" src="G:\ab.jpg"; width="400" />
</html>
Tags:
Web Technologies