Jump to content

Changing the images in a div automatically


Jaswinder

Recommended Posts

i want the images to change automatically in a div... i am not able to complete the code.. or dont know doing it correct or not

 

i am using following script

 

<script>
var a=new array("1.jpg","2.jpg","3.jpg")
var i=0
function show()
{
    document.getElementById("snap").src=a
    i++;
    if(i>2)
    {i=0}
}
setInterval("show()",1000)
</script>

 

<body>
<div style="height:500px; width:500px;" id="snap">

</div>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.