Re: DHTML Menus
by "Cyanide _7" <leo7278(at)hotmail.com>
|
Date: |
Mon, 22 May 2000 04:00:20 CDT |
To: |
bassmstr(at)westol.com |
Cc: |
hwg-languages(at)hwg.org |
|
todo: View
Thread,
Original
|
|
>I am trying my hand at some DHTML. I would like to set up a navigation
>bar which, when an image is clicked, if the user's browser does not
>support DHTML, goes directly to the link as usual, but if it can, a
>Javascript function is called to display a sub-menu (using DIV layers).
>Everything is working well so far, except that I'm not sure how to
>prevent the normal link from occurring. I thought that once the layer
>was displayed, returning a true or false value (I forget which) from the
>onClick event handler would tell the browser that the mouse click had
>been handled and it would not follow the link. I tried them both but
>with no success.
make sure your returning *false* FROM the event handler, not just TO the
event handler. example:
function showLayer(){
// code
return false;
}
RIGHT:
<a href="foobar.html" onClick="return showLayer('foobar');">foobar</a>
WRONG:
<a href="foobar.html" onClick="showLayer('foobar');">foobar</a>
in the second case, onClick merely evaluates to false and does not cancel
the action. hope this helps. - Cyanide_7
>
>Am I doing something wrong? (No surprise there - I'm not exactly a
>Javascript guru.)
>
>So, what do I do in an onClick event handler to prevent the mouse click
>from activating a location change?
>
>TIA,
>Steve
>___________________________________________________________________
>Steve Bassler
>email: bassmstr(at)westol.com, WebServant(at)pdinet.org, Bassler(at)lolc.org
>Visit PDI Ministries at http://www.pdinet.org
> Lord of Life Church at http://www.lolc.org
> or my own home page at http://www.westol.com/~bassmstr
>
>There's a wideness in God's mercy I cannot find in my own,
>And He keeps His fire burning to melt this heart of stone,
>Keeps me aching with a yearning, keeps me glad to have been caught
>In the reckless raging fury that they call the love of God.
> - Rich Mullins, 1955-1997
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
HWG: hwg-languages mailing list archives,
maintained by Webmasters @ IWA