|
Posted by Toby Inkster on 10/18/71 11:37
wai-tak sit wrote:
> can anybody tell me how can the webpage shows the x y coordinates of the
> cursor when I click on the web page?
You're opening a Pandora's box here!
Say I'm viewing a web page like this:
__________________________
| |
| Document |
|__________________________|
|x |
| Viewport |
| |
| |
| |
| |
| |
| |
|____________________________|
| |
| |
|__________________________|
That is, I've opened you web page and scrolled down a little way, so that
the top of your document has scrolled off the top of my screen.
If I click in the position marked "x", how far down the page am I? Zero
lines, because I'm at the top of my viewport; or four lines, because I've
scrolled down three lines of your document?
The problem is that when you use Javascript to determine the mouse
position, some browsers report the position relative to the viewport, and
some relative to the document.
Read more here:
http://www.evolt.org/article/Mission_Impossible_mouse_position/17/23335/index.html
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
[Back to original message]
|