jQuery in Action, 2nd edition*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "handling onclick" Watch "handling onclick" New topic
Author

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;">

Bosun


Bosun (SCJP, SCWCD)
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
Greenhorn

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: http://aspose.com/file-tools
 
subject: handling onclick
 
Similar Threads
Databases and jsp
image onclick use
Validate a form
Can parameters be scriptlet in onclick? If not, alternate?
how to pass String value in onclick function of javascript