felicia7
09-01-2003, 01:08 PM
hi i need help in one of my script... it is about automatic image update which is like an animated gif but it is using jpg.
Below is my script... i dunno why my pic can't show up...
<HTML>
<HEAD>
<SCRIPT LANGUAGE = "JavaScript">
timedelay = 1000; //in 1000th of a second
temp = 0;
NumberOfImages = 4;
animation = new Array();
for (i = 0; i < NumberOfImages; i++) {
animation[i] = new Image (640, 480);
animation[i].src = 'anim' + (i + 1) + '.jpg';
}
function AnimateImages()
{
NextImage();
setTimeout("AnimateImages()", timedelay);
}
function NextImage()
{
document.animatedimage.src = animation[temp].src;
temp++;
if(temp >= NumberOfImages) temp = 0;
}
</SCRIPT>
</HEAD>
<BODY>
<TITLE>Automatic Image updater</TITLE>
<TABLE BORDER=0>
<TR><TD>
<FONT SIZE=3>
</TD><TD>
<IMG SRC="anim1.jpg" NAME="animatedimage" WIDTH=640 HEIGHT=480 BORDER=0>
</TD></TR></TABLE>
</BODY>
</HTML>
thanks 4 yr help!!
Below is my script... i dunno why my pic can't show up...
<HTML>
<HEAD>
<SCRIPT LANGUAGE = "JavaScript">
timedelay = 1000; //in 1000th of a second
temp = 0;
NumberOfImages = 4;
animation = new Array();
for (i = 0; i < NumberOfImages; i++) {
animation[i] = new Image (640, 480);
animation[i].src = 'anim' + (i + 1) + '.jpg';
}
function AnimateImages()
{
NextImage();
setTimeout("AnimateImages()", timedelay);
}
function NextImage()
{
document.animatedimage.src = animation[temp].src;
temp++;
if(temp >= NumberOfImages) temp = 0;
}
</SCRIPT>
</HEAD>
<BODY>
<TITLE>Automatic Image updater</TITLE>
<TABLE BORDER=0>
<TR><TD>
<FONT SIZE=3>
</TD><TD>
<IMG SRC="anim1.jpg" NAME="animatedimage" WIDTH=640 HEIGHT=480 BORDER=0>
</TD></TR></TABLE>
</BODY>
</HTML>
thanks 4 yr help!!