GWT 将光标设置到位置 (x,y)

发布于 2024-11-17 09:39:29 字数 38 浏览 1 评论 0原文

在GWT中,是否可以将光标位置设置为位置(x,y)(上,左)?

in GWT, Is it possible to set the cursor position to a location (x,y) (top,left) ??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

初相遇 2024-11-24 09:39:29

你指的是鼠标光标吗?如果是这样,浏览器不会提供用于设置鼠标光标位置的 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 use TextBoxBase.setCursorPos() to set the caret to a particular offset within the text.

无畏 2024-11-24 09:39:29

出于安全考虑,在 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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文