是否可以在文档加载事件上获取鼠标光标的位置/位置。 (在javascript中) [英] Is it possible to get the location/position of the mouse cursor on document load event. (in javascript)

查看:68
本文介绍了是否可以在文档加载事件上获取鼠标光标的位置/位置。 (在javascript中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是想知道是否可以从文档的onload事件中获取鼠标的x / y位置(在任何mousemove事件之前)。

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).

谢谢

Guido

推荐答案

简答:否

长答案:是的。 onload事件不提供有关鼠标位置的信息,但是你可以在onload触发时设置一个变量,并在文档加载后鼠标移动时使用文档上的onmousemove事件来获取鼠标定位(在变量之后)已设置)。但不是你想要的。

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.

这篇关于是否可以在文档加载事件上获取鼠标光标的位置/位置。 (在javascript中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆