Animated gif

V

vvega

Hello,
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?

thanks,
vvega
 
N

Neredbojias

With neither quill nor qualm, vvega quothed:
Hello,
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?

Edit the script to reload the gif.
 
I

Ivo

I have a script which opens on click a new window in a certain way,
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?

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.
hth
ivo
 
V

vvega

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?
 
R

rf

vvega said:
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?

Yes.

Show us the script.

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

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

http://jibbering.com/faq/#FAQ4_24

Cheers
Richard.
 
R

Randy Webb

vvega said the following on 8/30/2005 7:56 PM:
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?

Several:

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.
 
R

Richard Cornford

vvega said:
I have to say I am totally ignorant in javascript...:|

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:-

I added "return false;" at the end of the script but it
doesnt make the effect I am looking for.

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:-

Do you have any other suggestion?

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.

Richard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,807
Latest member
ryef

Latest Threads

Top