在javascript中识别/获取选定的上下文菜单项 [英] Identifying/Getting selected contextmenu item in javascript

查看:47
本文介绍了在javascript中识别/获取选定的上下文菜单项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在正在学习javascript,因此请务必尝试并仔细说明.

I'm just learning javascript right now, so please do try and explain with that detail in mind.

我想做的就是这个-当用户右键单击或使用键盘上的上下文菜单时,我想知道他在上下文菜单中选择了什么选项.我主要想知道他是否选择了粘贴".我知道有一个"onPaste"事件处理程序,但我正在寻找另一种方法.

What I want to do is this exactly -- when a user right-clicks or uses contextmenu from keyboard, I want to know what option he selected in the contextmenu. mainly I want to know if hes selected 'paste' or not. I know that there is an 'onPaste' event-handler but im looking for another approach.

谢谢.

推荐答案

无法从JavaScript读取上下文菜单.您能做的最好的就是通过听其他事件来推断用户的选择.可能是一团糟.

There is no way to read the context menu from JavaScript. The best you'll be able to do is to infer the user's selection by listening to other events. That could be messy.

这篇关于在javascript中识别/获取选定的上下文菜单项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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