Forum Moderators: open

Message Too Old, No Replies

animatd gifs within java

         

user999

9:34 pm on Nov 16, 2005 (gmt 0)

10+ Year Member



i am trying to get an animated gif to play after another gif has finished animating on a webpage, someone sugested to me to use javascrpt timing to load a page after the animation has finished in the same window, i had looked for the coding for it on the net but with little suces, if anyone could help me with this problem or give me the coding for it i would be greatful.

Fotiman

9:59 pm on Nov 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I believe you're referring to the settimeout function:

<body onload="setTimeout('yourfunction()',5000);">

Note that the 2nd parameter to the setTimeout function is the delay in milliseconds (5000ms = 5 seconds).

Hope that helps.

user999

10:05 pm on Nov 16, 2005 (gmt 0)

10+ Year Member



thnx for the help, its the "function" part im stuck with.

Fotiman

11:16 pm on Nov 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Maybe something like:

<html>
<head>
<script type="text/javascript">
function swapImage()
{
var img = document.getElementById("mypic");
if(!img ) return;
img.src = "new.gif";
}
</script>
</head>
<body onload="setTimeout('swapImage()',5000);">
<img src="orig.gif" id="mypic">
</body>
</html>

That's obviously a very trimmed example, but it works.