Re: events and image
- From: Tony <tony23@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 29 Jun 2006 13:58:26 -0700
amit wrote:
Hi group,
Long story short, I'm new to JavaScript and have started it less than 3
weeks. My question is
1) how can I create a situation that when user clicks on gif or ...
image file an event get triggered?
what I have done is:
Testing image:
<a href="" name="linkImg1"
onclick="javascript:my_trker('http://www.mywebsite.com/akohan');" >
<img name=img1 src="flower.gif" border=0 >
</a>
the problem is that when I click on this image it goes thru the
function but then the page changes to the path:
http://www.mywebsite.com/akohan and shows a list or directory of the
files I have there!
The reason for that is: href="". If you want to STOP the click from going through, you need to add return false to your onclick:
onclick = "doSomething(); return false"
BTW, 'javascript:' is not needed for onclick
--
"The most convoluted explanation that fits all of the made-up facts is the most likely to be believed by conspiracy theorists. Fitting the actual facts is optional."
.
- Follow-Ups:
- Re: events and image
- From: amit
- Re: events and image
- References:
- events and image
- From: amit
- events and image
- Prev by Date: Detecting which context menu item was selected
- Next by Date: Re: IE DOM
- Previous by thread: events and image
- Next by thread: Re: events and image
- Index(es):