It's not a secret anymore!
The moose likes HTML, CSS and JavaScript and the fly likes handling onclick Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "handling onclick" Watch "handling onclick" New topic

handling onclick

mou haj
Ranch Hand

Joined: Sep 12, 2001
Posts: 81
cant I DO onclick on an image... in netscape.. Ican do that in IE
then... how will i call a function from a button....If I call thriugh href then if there is return false in the javascript function..the code is not working
please help
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Do something like this. It works in both Netscape and IE.
<A href="javascript:void 0" ONCLICK="yourFunctionName();return false;">


So much trouble in the world -- Bob Marley
mou haj
Ranch Hand

Joined: Sep 12, 2001
Posts: 81
thanx a lot Bouson.... I found out another way ... instead of writing return false if you only write return it works... return true and return false are only required if you want to specifically capture them... simply mentioning return means coming out of function
A1ien51 CNEUFOs

Joined: Nov 05, 2001
Posts: 16
hello there
here is a quick answer to the above
for the button
<input type="button" onclick="funcname()" name="hm" value="Click">
for the link, three ways
<a href="javascript nclick="funcname()">hmmmm</a>
<a href="javascript:void(0);" onclick="funcname()">hmmmm</a>
<a href="# onclick="funcname()">hmmmm</a>

hope this helps
I agree. Here's the link:
subject: handling onclick
It's not a secret anymore!