Make the href anything you want ("#" will work), but in the onclick handler,
do this:

onclick="openWidgetWindow();return false"

the return false statement keeps the browser from following the link.

for a ridiculously complete discussion of the topic, including handling
non-javascript enabled browsers, see

http://www.kottke.org/notes/0112.html#011227

and

http://milov.nl/?comments=474




-----Original Message-----
From: John M. Corro [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 29, 2002 9:31 AM
To: [EMAIL PROTECTED]
Subject: Non-Struts Related JS Question


Does anyone know how to call a javascript function from an html link w/o
causing the parent page to reload, but still having the cursor change to a
pointing finger when it goes over the link?

I'm trying to implement the following basic situation....user clicks on a
link, a child window pops up w/ a listing of widgets, user clicks on a
widget, and a value is passed back to the parent page.  I've been able to
get everything working (popup window, widget listing, return value, etc) w/
an anchor tag like this...
<a onclick="openWidgetWindow()">Click here to see a listing of Widgets</a>

However, one thing w/ this is that the mouse cursor doesn't change to a
pointing finger when it goes over the link because I don't have the href
attribute set.  I can manipulate the stylesheet settings so that it "looks"
like a regular link (underline, same color as all links), but the cursor
never changes to a pointing finger to indicate to the user that it's just a
plain old link to click on.  When I try putting in the href attribute, the
page tries to reload (don't want that happening).  I've tried a variety of
dummy values for the href (pound sign '#', blank, etc), but every value I've
tried seems to make the page reload.

Reply via email to