Hi, I didn't receive the original of this message, so I reply to this reply.
I needed the same functionality, and came up with this solution:
Remember, we are trying to use a link like this:
<a href="http://www.cnn.com" onclick=alert("hi");return false;>click</a>
This would normally only show the alert, as the navigation has been
cancelled by the "return false".
This doesn't work in DynAPI however.
So, in mouse.js I added this:
browserReturn = true
at line 33 just after "DynMouseEvent.forceMouseUp = false"
and changed line 64 from "evt.browserReturn=true" to
evt.browserReturn=browserReturn;
Now in links where you want to cancel the default navigation you do this:
<a href="http://www.cnn.com"
onclick=alert("hi");browserReturn=false;>click</a>
And it works the same as "return false" would. All other links keep normal
behavior.
Note that you now no longer need to use "javascript:void(0)" it will work
fine like this:
<a href="" onclick=alert("hi");browserReturn=false;>click</a>
This has not been thoroughly tested yet, so I'm not sure if this is the best
solution, or if this should be in CVS or not...
BTW, I'm also going to be making a backwards-compatible (readable in
browsers without javascript, or javascript version 1.0) dynapi page soon, so
any tips you (Ernest or others) have would be appreciated.
Cheers,
Richard Bennett
[EMAIL PROTECTED]
www.richardinfo.com
(Everything running on, and ported to DynAPI2.53)
visit the DynAPI homepage (and FAQ) ::
http://dynapi.sourceforge.net/dynapi/index.php?menu=1
Browse (and search) the mailinglist here:
http://www.mail-archive.com/index.php3?hunt=dynapi
----- Original Message -----
From: "Michael Pemberton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 30 June, 2001 13:56
Subject: Re: [Dynapi-Help] (no subject)
> You could try putting this link on a "splash" page that does not use the
> dynapi mouse events. This will allow you to support the onclick method of
> the href.
>
> >From my memoery, the current event structure overrides the user defined
> mouse events on links. This is the same problem that was being had with
> onload events being placed in the body tag being overridden the by the
> dynapi load handler.
>
> The code to get around this for NS4 href links would be too great a
burden.
> It would require making a hook for each link in the page and then
evaluating
> it as part of the dynapi event bubbling.
>
> Dougal Campbell wrote:
>
> > I've got some links defined that use href="javascript:..." to pop up
> > some DynLayers. For (extreme) backwards compatibility, I wanted to
> > change the hrefs to reference actual html files, and use the onclick
> > event instead. I figured that this way, script-enabled browsers will get
> > the mega gui version of my site, but somebody with lynx could still
> > access content.
> >
> > I tried something like this:
> > <a href="foo.html" onclick="showGuiWin(); return false;">Foo!</a>
> >
> > In a simple case, this would work fine. The "return false" would tell
> > the browser to *not* actualy load the foo.html page.
> >
> > But it seems that DynAPI's events are passing the click through anyways,
> > so what happens is that the showGuiWin() function is executed, but then
> > the browser loads foo.html.
> >
> > How can I accomplish what I'm trying to do?
> >
> > --
> > Ernest MacDougal Campbell III, MCP+I, MCSE <[EMAIL PROTECTED]>
> > http://dougal.gunters.org/ http://spam.gunters.org/
> > Lumber Cartel Unit #1654 (tinlc): http://come.to/the.lumber.cartel/
> > This message is guaranteed to be 100% eror frea!
> >
> > _______________________________________________
> > Dynapi-Help mailing list
> > [EMAIL PROTECTED]
> > http://lists.sourceforge.net/lists/listinfo/dynapi-help
>
> --
> Michael Pemberton
> [EMAIL PROTECTED]
> ICQ: 12107010
>
>
>
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-help
>
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help