Random Image selector after 1 minute

This code will change image after some time automatically


<script type="text/javascript">
var c=0
var s
function changeImage()
{
if (c%5==0){
document.getElementById('img').src = "images/7.jpg";
}
if (c%5==1){
document.getElementById('img').src = "images/5.jpg";
}
if (c%5==2){
document.getElementById('img').src = "images/11.jpg";
}
if (c%5==3){
document.getElementById('img').src = "images/2.jpg";
}
if (c%5==4){
document.getElementById('imgphoto-gallery').src = "images/3.jpg";
}
c=c+1
s=setTimeout("changeImage()",2000)
}
</script>
call this function on load
<body onLoad="changeImage()">


Comments

Author: Augustin09 Jun 2010 Member Level: Gold   Points : 0

Hi
Nice Article


Thanks
Augustin



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: