PDA

View Full Version : Get the name of a div onClick



troelsy
19 Dec 2010, 05:16 AM
Hi, i'm making a simple website for a school project. I want to know, how to get the x coordinate (or "left" as it is called in CSS) of the button the users presses. i use "class" for the div boxes.

My friend said, i could use document.getElementByClassName(), but i don't know how it works. Can you give an example of how to get the x coordinate? :)

Other solutions will be fine too.