city_coder
04-10-2008, 02:54 PM
I was wondering if it possible to figure out using javascript, which button was pressed.
Let me explain.
Imagine a load of links on the page like so:
<a href="" onClick="check()" id="dog"><img src="image.png"></a>
<a href="" onClick="check()" id="cat"><img src="image1.png"></a>
<a href="" onClick="check()" id="horse"><img src="image2.png"></a>
etc etc..
so in the onClick function, check, i would want to be able to get the id of the a tag that was clicked.
The reason i ask is because i want to be able to build it into an ajax function. but i need to know which 1 was clicked.
Is there anyway of finding out?
Let me explain.
Imagine a load of links on the page like so:
<a href="" onClick="check()" id="dog"><img src="image.png"></a>
<a href="" onClick="check()" id="cat"><img src="image1.png"></a>
<a href="" onClick="check()" id="horse"><img src="image2.png"></a>
etc etc..
so in the onClick function, check, i would want to be able to get the id of the a tag that was clicked.
The reason i ask is because i want to be able to build it into an ajax function. but i need to know which 1 was clicked.
Is there anyway of finding out?