在浏览器中模拟按键?
是否可以在浏览器(js、canvas、服务器端?)上模拟按键操作,假设我在某些数据结构中按下了一些按键,左右上下加载了一个 flash 文件,所以我不用输入 left right浏览器上下执行它,flash读取那些东西?有点像宏。
Is it possible to simulate key press on the browser (js, canvas, server side?), let says I have some key presses in some data structures, left right up and down there is a flash file loaded so instead of me typing left right up and down the browser execute it and the flash reads those things? Kind of like a macro.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不太确定它是否适用于 Flash 嵌入,但您绝对可以使用 JavaScript 来模拟按键。
如果您还没有,您应该查看 jQuery。 (如果你想用 JavaScript 快速完成工作,并且是新手,那么我建议你甚至不要费心去学习 JavaScript,而是学习 jQuery(jQuery 是一个 JavaScript 库,所以你仍然会使用/编写 javascript) ,除了一组更强大的玩具))
在 jQuery 中执行左,右,上,下将是......
这可能不会给你你正在寻找的东西,但看看 jQuery sendkeys 扩展 < a href="http://bililite.com/blog/2011/01/23/improved-sendkeys/" rel="nofollow">http://bililite.com/blog/2011/01/23/improved-sendkeys /
I'm not exactly sure if it would work on a Flash embed but you can definitely simulate keypresses by using JavaScript.
If you haven't already, you should check out jQuery. (If you want to Get Things Done, fast with JavaScript, and are new, then I would suggest to don't even bother learning JavaScript and learn jQuery instead (jQuery is a JavaScript Library, so you'd still be using/writing javascript, except with a much more powerful set of toys))
in jQuery to do a Left,Right,Up,Down would be...
This might not give you exactly what you are looking for, but have a look at jQuery sendkeys extension http://bililite.com/blog/2011/01/23/improved-sendkeys/