Everyone shoul dread this.. a couple of tips here.

Alright. Consistent, X-browser, and reliable links:
I have had many problems with <a > tags not reacting 'normally' may here in
the
office have had the same problem, unless they write their links the
way I keep telling them too.
(they forget, do it their way, then come running to me cause their code
won't work)


So: rules
1) the only thing in href="" should a an Href, not javascript.
2) if you code calls a function or initiatesx anythig intensive
    (such as crazy animation or loading a page into a layer or frame)
    then add a 'return false' to tell the browser you are done and that it
    can go ahead with what it needs to do.
    So:

BAD:
a href="javaswcript:alert('a bad link')">click me
Reasons:
    Because we are using an alert this is not too bad.
    If we where calling a larger function we may have problems.
Possible issues:
    -code in function (other than alert ;) may not execute)
    -you may get a 'phantom busy cursor' in some OS/Browser combos
            (this is where you get a bussy/hourglass cursor whcih does not
go away
            even tho the browser is definatly NOT busy.

STILL BAD (but not as bad):
a href="javascript:void(null;" onclick="alert('a somewhat bad link')">click
me
Reason:
    -while we are running the code from a more stable event.. we may still
have problems
    on some (but not many) OS/browser combos.
Possible issues:
    -on NS 4X on win32 you _will_ get a 'phantom busy cursor' when
        you code causes an image or web page to load from the server.
    -on NS 4x on win32 you wil lfind that some code won't even execute
normally
        without returning from the event.
        One example being the 'embedded HTML test' I posted a little while
ago.
        I found that without the 'return false' the javascript in the file
that I was loading into the Ilayer
        did not execute. After pulling my hair out for a couple of hours one
of my co-workers
        gave me my own advice, and I put the return false...
    now the embeded HTML example works.



Best Link:
a href="javascript:void(null;" onclick="alert('a somewhat bad link'): return
false">click me
Reason:
    -we now retun 'false' after calling the code in our onclick.
    What this does is tells the browser that we are "finished navigating" to
the link.
    The browser knows that this meas it's time to return the cursor to
normal and
    to process any pending events/execution (see above)

----- Original Message -----
From: "Colin Thompson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, November 25, 2001 9:57 AM
Subject: [Dynapi-Help] problem with animated gifs


> IE5.5 Windows ME
>
> I'm having various problems related to animated gifs and DynAPI. for
> example, trying to have my gif follow a path using <a
> href="javascript:path.playAnimation(circlepath,true)">Play</a> freezes the
> gif animation.
>
> trying the same method using a button - ie
>
>  var playbutton = new Button("Play)");
>  playbutton.moveTo(5,5);
>  DynAPI.document.addChild(playbutton);
>
>  var l = new EventListener(playbutton);
>  l.onclick = function(e) {
>   var o = e.getTarget();
>   path.playAnimation(circlepath,true)
>  }
>  playbutton.addEventListener(l);
>
> works perfectly. Why does it not work from a link?
>
> Same thing happens with viewports. if you use a <a href> to control
> scrolling it stops any gif animations contained in the viewport.
>
>
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dynapi-help


_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dynapi-help

Reply via email to