|
Need help with this script for animating pic new to forum!!!!!
Hi Im new here and just recently getting into coding and I can't seem to figure what my problem is. I am using this to simulate a picture fading into another. After it finishes one cycle of the imgList it doesnt renew the first picture, it shows it as an invalid link. Any ideas?
Caleb
<script type="text/javascript">
//animate header
//use array to make list of images
var imgList=new Array(
"Live Graphics/header1A.gif",
"Live Graphics/header1A.gif",
"Live Graphics/header1A.gif",
"Live Graphics/header1A.gif",
"Live Graphics/header1A.gif",
"Live Graphics/header1b.gif",
"Live Graphics/header1c.gif",
"Live Graphics/header1d.gif",
"Live Graphics/header1e.gif",
"Live Graphics/header1f.gif",
"Live Graphics/header1g.gif"
);
var frame=1;
var spriteImage
function init(){
setInterval("animate()",200);
spriteImage=document.getElementById("image");
};//end init
function animate(){
frame++ ;
if (frame>imgList.length){
frame=1;
}//end if
spriteImage.src=imgList[frame];
}
</script>
|