View Full Version : help with image coordinates

05-24-2012, 09:59 AM
So i have an image, lets say a cow. When i click on part of the body, it shall show information about it, for example head. I have coordinates in javascript in array(position and size),but i have no idea what should i do later?? Onclick and switch?

05-24-2012, 11:19 AM
thanks for reply.
the problem is i can't edit index.html file and body contains only something like that:

<div id="parts">
<div id="body_map"><img src="body.jpg"></div>

i cant add onclick or usemap :S

05-24-2012, 11:35 AM
Sorry for confussion, but at the time i was posting i didn't know that :). Neither i can't split image, it's for my class and those are requirements.

As i said, html looks like above and js is an array with name of body part, and it's position(top, left) and size(height,width).

My newest guess is to find position of x and y using addEventListener, here's an example:


but i don't understand why it works only with <table> tags..