Animated gif

Discussion in 'HTML' started by vvega, Aug 30, 2005.

  1. vvega

    vvega Guest

    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
     
    vvega, Aug 30, 2005
    #1
    1. Advertising

  2. vvega

    Neredbojias Guest

    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.

    --
    Neredbojias
    Contrary to popular belief, it is believable.
     
    Neredbojias, Aug 31, 2005
    #2
    1. Advertising

  3. vvega

    Ivo Guest

    "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
     
    Ivo, Aug 31, 2005
    #3
  4. vvega

    vvega Guest

    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?
     
    vvega, Aug 31, 2005
    #4
  5. vvega

    rf Guest

    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.
     
    rf, Aug 31, 2005
    #5
  6. vvega

    Randy Webb Guest

    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
     
    Randy Webb, Aug 31, 2005
    #6
  7. 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.
     
    Richard Cornford, Aug 31, 2005
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeronimo Bertran

    Creating animated GIF dynamically

    Jeronimo Bertran, Nov 13, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    498
    Xin Huang [MSFT]
    Nov 14, 2003
  2. Shabam

    Animated GIF handling

    Shabam, Mar 5, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    351
    Shabam
    Mar 5, 2004
  3. =?Utf-8?B?S29lbiBIb29yZWxiZWtl?=

    reading an animated gif ...

    =?Utf-8?B?S29lbiBIb29yZWxiZWtl?=, Oct 9, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    526
    =?Utf-8?B?S29lbiBIb29yZWxiZWtl?=
    Oct 10, 2004
  4. =?Utf-8?B?QWw=?=

    Animated GIF affected by location.replace

    =?Utf-8?B?QWw=?=, Oct 12, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    7,302
    =?Utf-8?B?QWw=?=
    Oct 21, 2004
  5. Joe
    Replies:
    0
    Views:
    3,139
Loading...

Share This Page