I'm just learning javascript right now, so please do try and explain with that detail in mind.
我现在正在学习javascript,所以请尽量尝试解释这个细节。
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.
我想要做的就是 - 当用户右键单击或使用键盘上下文菜单时,我想知道他在上下文菜单中选择了哪个选项。主要是我想知道他是否选择了“粘贴”。我知道有一个'onPaste'事件处理程序,但我正在寻找另一种方法。
Thanks in advance.
提前致谢。
1 个解决方案
#1
2
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中读取上下文菜单。您能够做的最好的事情是通过收听其他事件来推断用户的选择。那可能很混乱。
#1
2
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中读取上下文菜单。您能够做的最好的事情是通过收听其他事件来推断用户的选择。那可能很混乱。