Re: events and image



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