用Javascript右键单击后如何获取/检索上下文菜单值? [英] How to get/retrieve context menu value after right click with Javascript?

查看:67
本文介绍了用Javascript右键单击后如何获取/检索上下文菜单值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到相关的问题来告诉我如何执行此操作。

I can't find a related question to give me an idea about how to do this.

我已经看到了一些有关如何知道是否正确的主题。单击了单击按钮,但是我希望能够在右键单击后捕获上下文菜单中选择的值。

I've seen some topics about how to know if the right-click button was clicked but I'd like to be able to capture the value that's selected on a context menu after right click.

任何想法我都可以实现吗?

Any idea how I could achieve it?

推荐答案

在浏览器中,您可以:

a)忽略右键单击并让浏览器本身进行处理(通常意味着将显示一个上下文菜单)

a) ignore the right click and let the browser itself handle it (which usually means a context menu will be shown)

XOR

b)自己处理右键单击,这意味着浏览器将不会显示其上下文菜单。

b) handle the right click yourself, which means that the browser won't show its context menu.

您不能同时拥有a)和b),它们是互斥的。如果要在网页上单击右键上下文菜单,则需要自己进行伪造-例如,请参见本教程结果

You can't have both a) and b), they're mutually exclusive. If you want a right-click context menu on a webpage, you need to fake it yourself - for example, see this tutorial and the result.

这篇关于用Javascript右键单击后如何获取/检索上下文菜单值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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