From: Joachim L. <lu...@ho...> - 2001-07-10 20:54:09
|
(This was an oldie) At 2001-06-29 22:52, you 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? I think alert() and other lengthy operations such as open new browser windows will cancel the return value (that was totally clear, wasn't it?) because the browser needs the return value ASAP (preferably sooner) and when the onclick event takes a long time the return value is scrapped. [I may be totally off track here, but that is how it appears to me.] <a href="foo.html" onclick="setTimeout('showGuiWin();',0); return false;">Foo!</a> should do the trick (and does for me). /Lunna |