Animated gif

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have a script which opens on click a new window in a certain way, that is
without browser's windows objects. The problem is that in the same first
page there is also an animated gif, and this gets interrupted when the
script is activated.. do you have any solution to suggest me?


Re: Animated gif

With neither quill nor qualm, vvega quothed:

Quoted text here. Click to load it

Edit the script to reload the gif.

Contrary to popular belief, it is believable.

Re: Animated gif

"vvega" wrote
Quoted text here. Click to load it

Some code posting might help, but a guess is you forgot to return false from
the onclick event. Add "return false" at the end of the script and see if
that makes a difference. Usually, a click is the end of a page's life and
the start of another, so browsers tend to stop updating the page once the
click has occured. By returning false, you explicitly tell the browser to
keep the current page and its animations alive.

Re: Animated gif

I have to say I am totally ignorant in javascript...:|
I added "return false;" at the end of the script but it doesnt make the
effect I am looking for.
Do you have any other suggestion?

Re: Animated gif

vvega wrote:

Quoted text here. Click to load it


Show us the script.

Otherwise here is a wild guess:
You have <a href="javascript:...

IIRC it causes animated gifs to stop, amongst other things.


Re: Animated gif

vvega said the following on 8/30/2005 7:56 PM:
Quoted text here. Click to load it


1) Quote what you are replying to.
2) Drop the use of javascript: in your href's. That is without even
seeing your code because it is a known side-effect of <a
href="javascript: is that it causes animated gif's to cease being animated.
3) Read this groups FAQ, thoroughly.
4) Read section 4.24, at least 3 times. It covers this very issue.

comp.lang.javascript FAQ - & newsgroup weekly

Re: Animated gif

vvega wrote:
Quoted text here. Click to load it

Which means you don't really know what you are doing. Unfortunately
nobody else knows what you are doing unless you show them the code you
are using. Describing it is almost totally worthless as there are
usually at least half a dozen ways of doing anything with javascript,
and at least 50 ways of failing to do anything.

What you are left with is guesswork, informed or otherwise. You describe
what you are doing as activated onclick, but onclick events do not cause
unexpected side effects. On the other hand the well known cause of
unexpected side effects (and most commonly made apparent by animated
GIFs stopping animating) is the execution of javascript pseudo-protocol
HREFs in links. This implies that your link formulation is along the
lines of:-

<a href="javascript void 0;" onclick="doSomethong();">

Quoted text here. Click to load it

Ivo's suggestion of adding 'return false:' is a solution as returning
false will cancel the navigation and prevents the execution of the
javascript pseudo-protocol HREF, and so prevent the side effects of its
execution. It is however important to put the 'return false;' in the
right place, and "at the end of the script" is not enough information to
be able to tell whether you tried it in the right place. The result
should have resembled:-

<a href="javascript:void 0;" onclick="doSomethong();return false;">

- else the return false may be the last line in the function called, but
that required the onclick code to pass that returned value on by
returning the return value of the function call. I.E.:-

<a href="javascript:void 0;" onclick="return doSomethong();">

Neither of these changes will be effective if the function called in the
onclick handler generates a runtime error while it is executed, and we
cannot estimate the likelihood of that happening without seeing the code
being used.

Additionally, once the onclick handler is cancelling the navigation the
contents of the HREF become irrelevant in an environment where
javascript is enabled, and a javascript pseudo-protocol HREF is
inevitably worthless in an environment where javascript is not
available. As the HREF is irrelevant when javascript is available it
becomes free for use providing fall-back for javascript disabled
browsers. Which can be done by providing an HREF that is the URL of a
real resource (probably the URL of whichever resource you were planning
on opening in this new window). See:-


Quoted text here. Click to load it

1. Never ever use a javascript pseudo-protocol HREF.

2. Give up entirely on trying to open new windows with javascript, it is
more trouble than it is worth.


Site Timeline