Displaying image coordinates (was: Is This Possible???)

They have: 35 posts

Joined: Aug 2001

I have an image (of a galaxy) 500x500 and I wish to make it so that when the mouse is over it it shows at what point on the image it is.

ie:
-249, 390
160,40
and so on...

Is this possible?

Busy's picture

He has: 6,151 posts

Joined: May 2001

I believe you can do it with dHTML, kind of like a menu or image map but with titles at mouse point.

I remember a site that had something similar, was a world map and they used the time on mouse click, i'll see if i can find it. The gurus may have a better answer if not.

They have: 601 posts

Joined: Nov 2001

Web browsers automatically show you the coordinates of the mouse when using server-side image maps. It displays it in the bottom status bar. Is this what you're after?

Example: http://he.net/~seidel/Map/map.html

This used to be the case with many sites, such as the top bar on Yahoo! but they have all now been changed into client-side image maps. I'm not sure why to be honest, but it seems that server-side image maps are becoming more and more obsolete.

- wil

They have: 601 posts

Joined: Nov 2001

If you want to use Javascript to write the coordinates into your webpage, maybe the following will help:

http://www.milov.nl/forum/1/163

They have: 35 posts

Joined: Aug 2001

I had already started doing what I think those pages you posted tell me to do. But stopped cause I thought their may be a better way.

http://www.centrepointstation.net/test/list2.html

They have: 35 posts

Joined: Aug 2001

is that what the pages are suggesting? I also stopped because the file would have been masive at the completion of the map and I wondered if there was a way to make it easier.

They have: 601 posts

Joined: Nov 2001

I get a 404 not found on that link?

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

http://www.centrepointstation.net/test/right.html

In his post in the Authoring section he said he did everything again, and gave a new link.

So, if I'm guessing right, http://www.centrepointstation.net/test/right.html is the new link.

They have: 35 posts

Joined: Aug 2001

yup

detox's picture

They have: 571 posts

Joined: Feb 2001

this displays the coordinates on the status bar, shouldn't be hard to change the script to deal with an image with the onmousover event etc.
personally I would search for a more recent and powerful script, I know dynlayer2 has some properties like this, even check out bratta.com

[php]

gimme the coordinates

<script language=JavaScript>
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
function init() {
if (ns4) {document.captureEvents(Event.MOUSEMOVE);}
document.onmousemove=mousemove;
}
function mousemove(e) {
if (ns4) {var mouseX=e.pageX; var mouseY=e.pageY}
if (ie4) {var mouseX=event.x; var mouseY=event.y}
status="x= "+mouseX+", y= "+mouseY;
}</script>

[php]

They have: 601 posts

Joined: Nov 2001

Much easier jsut to use a server-side image map - and it's even cross-browser compatible as it doesn't rely on any javascript Smiling

They have: 35 posts

Joined: Aug 2001

thats what I ended up using

http://www.centrepointstation.net/test/map.html

cheers for the help guys

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.