Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Identify where on row was moused clicked 1

Status
Not open for further replies.

southbeach

Programmer
Jan 22, 2008
879
US
I am working on a data grid where via CSS I highlight the row. I also use the onclick event to trigger an action if any column within the row is clicked; this is done by using onclick( ... ) within the <tr ...> tag.

I want to use images on two or three columns to trigger different action based on the clicked image. Problem is that since I have an onclick event within the row, it also triggers that action.

I guess I could do away with the onclick event within the row and put it within the columns ...

That being said, I would like to employ a checking routine where I check for the value of X,Y coordinates and figure out possible column clicked.

After spending a while perusing through the google results, I found nothing on this regard.

Thank you all for you help!


--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
I'd continue with the 'onclick' on the 'tr', but have an additional 'onclick' for each of these images. Then, when any click is fired, detect the element that fired it, and if one of the images, stop the event from bubbling up. That way, you can have the best of both worlds.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
I was using the onclick on both the tr and the image, my problem was keeping the tr trigger from executing.

That being said, your suggestion makes a lot of sense and I opted to simply set a variable OK2OpenWindow to false if the image onclick event is triggered. I then modified my tr triggered script and check for this variable - If false, I then skipped the routine and set OK2OpenWindow back to true.

Problem solved!

Thanks ...


--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top