如何在元素上触发浏览器上下文菜单。 (好像用户右键单击) [英] How do I trigger the browser context menu on an element. (As if the user right-clicked)

查看:112
本文介绍了如何在元素上触发浏览器上下文菜单。 (好像用户右键单击)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过javascript触发浏览器(IE,Firefox,Safari等)上下文菜单的打开。我试图解决的问题是,当右键单击重叠元素时,它下面的元素显示其上下文菜单。因此,如果顶部元素是标签,当您右键单击时,我需要显示下面输入元素的上下文菜单。

I have the need to trigger the opening of the browser (IE, Firefox, Safari, etc) context-menu via javascript. The problem I am trying to solve, is when an overlaid element is right-clicked, the element below it shows its context menu. So if the top element is a label, when you right click, I need to show the context menu for the input element below.

我知道如何保持标签的上下文从显示菜单,但我不知道如何任意打开上下文菜单。

I know how to keep the label's context menu from showing, but I don't know how to open a context menu arbitrarily.

感谢任何帮助!

推荐答案

很抱歉成为持票人不幸的消息,但这是用Javascript无法做到的。

Sorry to be the bearer of unfortunate news, but this is impossible to do with Javascript.

这篇关于如何在元素上触发浏览器上下文菜单。 (好像用户右键单击)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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