Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Animated gif

Reply
Thread Tools

Animated gif

 
 
vvega
Guest
Posts: n/a
 
      08-30-2005
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

 
Reply With Quote
 
 
 
 
Ivo
Guest
Posts: n/a
 
      08-30-2005
"vvega" wrote
> 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




 
Reply With Quote
 
 
 
 
vvega
Guest
Posts: n/a
 
      08-30-2005
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?

 
Reply With Quote
 
rf
Guest
Posts: n/a
 
      08-31-2005
vvega wrote:

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



 
Reply With Quote
 
Randy Webb
Guest
Posts: n/a
 
      08-31-2005
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.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
 
Reply With Quote
 
Richard Cornford
Guest
Posts: n/a
 
      08-31-2005
vvega wrote:
> 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:-

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

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

<URL; http://www.jibbering.com/faq/#FAQ4_24 >

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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Freeware to make animated GIF (can Irfanview make an animated GIF?) Annu Pai Digital Photography 4 11-23-2009 12:52 AM
Animated GIF affected by location.replace =?Utf-8?B?QWw=?= ASP .Net 3 10-21-2004 01:41 PM
reading an animated gif ... =?Utf-8?B?S29lbiBIb29yZWxiZWtl?= ASP .Net 2 10-10-2004 12:37 AM
Animated GIF handling Shabam ASP .Net 0 03-05-2004 11:46 PM
Creating animated GIF dynamically Jeronimo Bertran ASP .Net 1 11-14-2003 03:46 AM



Advertisments