On 12/5/06, Juergen Schreck <[EMAIL PROTECTED]> wrote:
>
> Ok - perhaps I've tried a little too long and just can't see it. But
> I have a problem with a client using Safari 1.3 thru 2.0.3 reporting
> a problem with my javascript.
>
> I hope someone knows about this issue and can turn the lights on for
> me as to how to work around this problem.
>
> Consider the following code in <head>
>
> <script type="text/javascript">
> connect(window, 'onload', function (e) {
> app.home(e);
> var elems=$('header').getElementsByTagName('a');
> connect(elems[0], 'onclick', app.home);
> var
> elems=getElementsByTagAndClassName('a','menu_item');
> for (idx in elems) {
> connect(elems[idx], 'onclick',
> app.menu_action);
> }
> });
> </script>
>
> And then somewhere in the markup:
>
> <li><a name="mediarelations" class="menu_item" href="#"></a></li>
> <li><a name="graphicdesign" class="menu_item"
> href="graphicdesign.html"></a></li>
>
> The difference in the two links is the href. On the aforementioned
> Safari versions it seems like the href always gets executed BEFORE
> the onclick event fires, unless I put a # in there. So the first link
> above will work, the second won't - meaning it'll try to load
> graphicdesign.html and app.menu_action never get's a chance to
> execute. I do return false from app.menu_action, which prevents the
> execution of the href link as expected.
returning false is not how that works. You're supposed to call
e.stop() (or stopPropagation or preventDefault depending on if you
want just one of them).
-bob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---