Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Play an animated.gif on page load.

Posted on 2001-07-13
Medium Priority
Last Modified: 2008-03-06
I want to play a "shockwave" file or animate gif, then once it completes automatically load the next page.  That way someone looking (or watching) doesn't have to push a link to go in.
Question by:ambulance
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +3

Expert Comment

ID: 6281072
Suggestion :Use
  setTimeout(expression, msec)    

to wait until your animation is finished playing, all you need to know is how long it takes to play your image.. and then feed in the time in milliseconds.. I have used 5 seconds here:

<script language="javascript">
 function WitForIt()
     document.location = 'Nextpage.htm'

<body onload="setTimeout(WitForIt(), 5000)">


Expert Comment

ID: 6281103
If you are going to use shockwave or flash, then you can add code to the shockwave or flash file to call a function that will reload the page for you, with the correct url.

This way your users will always see the whole thing without you having to worry about getting the length of your animated gif correct.  This may be a concern if you have a complicated animation, older computers can play it slower, making the timing a little bit off.

If simple animation, time it and use the script RBertora gave you above.

Author Comment

ID: 6281110
On load, how do I get the shockwave or gif to play automatically?

Once I can figure out how to get it to play right away, I think the script will work.

Thanks for your help!
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Accepted Solution

davlun20080 earned 200 total points
ID: 6281139
Shockwave and flash have settings that need to be activated when you are building the file for the server.  Once set, they will activate the play for you all by themselves.

Animated GIF's will play automatically as well, once you load the page (or they should)

Author Comment

ID: 6281187
Okay, thanks. I'll try all of your ideas and get back to you.

Expert Comment

ID: 6287244
You don't really need the setTimeout. Use the meta refresh.
<META http-equiv="Refresh" content="10;URL=http://www.experts-exchange.com/">
. . .
. . .
<img src="your-animated image.gif" width=". . ." height=". . . " border="0" alt="">
. . .

Will allow your animation to play for 10 seconds then redirect to Experts Exchange.

And as stated earlier use Shockwave/Flash controls to redirect the viewer. (Although the <meta> tag should work for Flash as well.)
LVL 53

Expert Comment

ID: 7910367
This question has been abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
   In the absence of responses, I may recommend DELETE unless it is clear
   to me that it has value as a PAQ.  Silence = you don't care

LVL 53

Expert Comment

ID: 7999724
It is time to clean this abandoned question up.  

I am putting it on a clean up list for CS.

points to davlun20080


If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.


Expert Comment

ID: 8067974
per recommendation

Community Support Moderator @Experts Exchange

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question