Skip to content
Advertisement

Is it possible to get the location/position of the mouse cursor on document load event

Just wondering if its possible to get the x/y location of the mouse from the onload event of the document (before any mousemove events)?

Advertisement

Answer

short answer: no

long answer: yes. the onload event doesn’t provide info on the mouse position, however you can set a variable when onload has fired, and use the onmousemove event on the document to get the mouseposition as soon as the mouse moves after the documents loads (after the variable has been set). Not what you wanted, though.

Advertisement