How can I get the ID of an element that called a JS function?
body.jpg is an image of a dog as the user points his/her mouse around the screen at different
You can code the handler setup like this:
Then this
in your handler will refer to the element. Now, I'll offer the caveat that I'm not 100% sure what happens when you've got a handler in an tag, largely because I haven't seen an
tag in like a decade or so. I think it should give you the image tag, but that could be wrong.
edit — yes, it's wrong - you get the tag, not the
. So you'll have to get that element's parent (the map), and then find the image that's using it (that is, the
whose "usemap" attribute refers to the map's name).
edit again — except it doesn't matter because you want the area's "id" durr. Sorry for not reading correctly.