GWT 将光标设置到位置 (x,y)
在GWT中,是否可以将光标位置设置为位置(x,y)(上,左)?
in GWT, Is it possible to set the cursor position to a location (x,y) (top,left) ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
在GWT中,是否可以将光标位置设置为位置(x,y)(上,左)?
in GWT, Is it possible to set the cursor position to a location (x,y) (top,left) ??
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
你指的是鼠标光标吗?如果是这样,浏览器不会提供用于设置鼠标光标位置的 API。
如果您正在讨论
TextArea
或类似小部件中的文本插入插入符号,则可以使用TextBoxBase.setCursorPos()
将插入符号设置为文本内的特定偏移量。Are you referring to the mouse cursor? If so, browsers don't provide an API for setting the position of the mouse cursor.
If you're talking about a text insertion caret in a
TextArea
or similar widget, you can useTextBoxBase.setCursorPos()
to set the caret to a particular offset within the text.出于安全考虑,在 JS 中无法设置鼠标光标。想象一下进入一个网站,它突然开始为您移动鼠标......并可能点击该网站上的广告。你会在浏览器中添加这样的功能吗?
Setting mouse cursor is not possible in JS, due to security. Think of entering a site which suddenly starts to move your mouse for you ... and possibly click ads on this site. Would you add such feature to browser?