When I run it, the 1st image appears and after one second all I could see is a white blank screen. Nothing happens. I guess there's a problem in JavaScript code. Here's the code I tried..
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
img {
width: 582px;
height: 306px;
}
</style>
</head>
<body>
<img src="image-slider-1.jpg" id="myphoto" />
<script type="text/javascript">
var image=document.getElementById("myphoto");
var imageArray=("image-slider-1.jpg","image-slider-2.jpg","image-slider-3.jpg","image-slider-4.jpg","image-slider-5.jpg");
var imageIndex=0;
function slide(){
image.setAttribute("src",imageArray [imageIndex] );
imageIndex++;
if(imageIndex>=imageArray.length) {
imageIndex=0;
}
}
setInterval(slide,1000);
</script>
</body>
</html>
Any help is greatly appreciated.
()instead of[]