It seems so simple, and I thought I would be able to find help on the net, but it appears that I am wrong. I have an image and when the mouse is over the area coordinates I want it to show the x and y coordinates for that image in a div tag.
It seems so simple, and I thought I would be able to find help on the net, but it appears that I am wrong. I have an image and when the mouse is over the area coordinates I want it to show the x and y coordinates for that image in a div tag.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
it's an image map.
I have a compact script I use while editing with IE. No sense having it cross browser when it's only a local utility. Just paste the stuff in the page you're editing and take it out when you're done. You'll have to tweak it a bit to make it work over your specific div...
PHP Code:<script type="text/javascript">
document.onmousemove = Kcur;
function Kcur() {
X=event.clientX+document.body.scrollLeft;
Y=event.clientY+document.body.scrollTop;
kxy.innerHTML=" Top="+Y+"<br> Left="+X+"";
kxy.style.pixelTop=Y;kxy.style.pixelLeft=X;
return true;
}
</script>
<div id="kxy" style="border:1px inset ;position:absolute;padding:2px;font-family:fixedsys;"> </div>
That might do the trick here, but that would be up to markmil2002 to decide.
Personally, I'm still not clear on what is wanted here or why. The why isn't so important, except that it would help me a lot with the how. The what is important. Do you want this for the live page, or as Kenny is offering, only as a diagnostic tool? If for a live page, it would need to be cross browser, and probably only active while over specific area tags. Do you want the actual mouse coords relative to the page, the coords of the area tag, or the coords of the mouse relative to the image with the top left edge of the image being 0, 0? If Kenny's idea doesn't 'do it' for you, please be more specific as to what is required and why.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Bookmarks