faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

2 of 19 people (11%) answered Yes
Recently 0 of 10 people (0%) answered Yes


How can i know the top left coordinates of a window after it is moved with mouse?

Apr 5th, 2008 20:45
ha mo, Colin Fraser, Ravinder Singh,

While I wont be supplying the specific answer, I just dont have time to
write it and prove it. Sorry to say this but it cannot be done like you
want it to. 
I have considered a number of different approaches and all failed at the
same point, that is, calculating the difference between the two points
where the mouse was clicked, preparing to move the window, and where the
mouse was released, repositioning the window. This calculation is
dependent upon a single reference coordinate, that is the top left
corner of the screen, the 0,0.  
In a language like C++ or even Visual Basic, this is a somewhat trivial
matter, but JavaScript does not extend to the whole screen, just the
active window. More correctly, JavaScript only tracks the mouse pointer
inside the active window not across the whole screen.
I hope someone will prove me wrong here, and prepare a script that works
as i could think of a number of applications where this may be a useful
Sorry I could not be of any more help.