Is there a way to have a .gif automatically refresh to another .gif after a specific time period?

Sealuv98
Sealuv98 used Ask the Experts™
on
I am trying to make a gif automatically refresh after ~20 seconds and load a new gif in the same place.  Any ideas?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

<BODY onLoad="setTimeout('document.images[\'myimage\'].src=\'newgif.gif\';',20000);">

<IMG name='myimage' src='mygif1.gif' border='0'>

</BODY>
Or better still:

<img src="image1.gif" name="myimg" onLoad="setTimeout('document.images[\'myimg\'].src=\'image2.gif\';',20000);"/>

Which will do it when the actual image loads rather than the page loads.

Author

Commented:
OK boughtonp,
I am trying to work with your solution, as I would like it to work when the image loads.
<img src="image1.gif" name="myimg" onLoad="setTimeout('document.images[\'myimg\'].src=\'image2.gif\';',20000);"/>

Your solution is above.  I understand the first half, however, where do I input the time limit?  Say the first pic I want to load is www.pics.com/images/image1.gif and the second is www.pics.com/images/image2.gif, could you show me how the code would be with those examples in it?  The image names can be image1 and image2 and the time interval I'd like to be 10 seconds.  I'm just not seeing where I should be inputing these things.
Thanks!
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

setTimeout uses milliseconds, so 20000 would be 20 seconds, 10000 would be 10, etc.

Author

Commented:
Right now this is what I have, but it's not working.  Any ideas?

<img src="http://www.email-mbsinsight.com/mbs/Email_append/Email_Append_Site/Hopping.gif" name="hopping" width="218" height="47" onLoad="setTimeout('document.images[\'hopping\'].src=\'http://www.email-mbsinsight.com/mbs/Email_append/Email_Append_Site/images/email_append_06.gif';',10000);"/>
I think you are missing a back-slash at the end :

.gif\';',10000);"/>

      ^

Author

Commented:
Thank you KnightEknight.  I really appreciate the help.  Sometimes no matter how much you look at it, you can't see what's wrong with it.  

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial