English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Referenzhandbuch

Vollständiges Verzeichnis der HTML-Tags

HTML contextmenu-Attribut

Die globale contextmenu-Attribut ist die ID-Attribut des <menu> für das "Kontextmenü" eines Elements. Ein Kontextmenü ist ein Menü, das bei Benutzerinteraktionen (z.B. rechter Mausklick) angezeigt wird. HTML5Ermöglicht es uns, dieses Menü zu personalisieren. Hier sind einige Implementierungsexemplare, einschließlich eingebetteter Menüs.

Globale Attribute von HTML

Die contextmenu-Attribut ist veraltet und wird aus allen Browsern entfernt.

Online-Beispiel

Weisen Sie dem <div>-Element ein Kontextmenü zu. Wenn der Benutzer mit der rechten Maustaste auf das Element klickt, wird das Kontextmenü angezeigt:

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>HTML contextmenu 属性的使用(基础教程网 oldtoolbag.com)</title>
</head>
<body contextmenu="share">
<menu type="context" id="share">
    
     <menu label="share">/<menuitem label="Facebook">Facebook<
     <menuitem label="Twitter">Twitter</<menuitem label="Facebook">Facebook<
   </menu>
 </menu>
</body>
</html>
Test to see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

Currently, only the Firefox browser supports the contextmenu attribute.

Definition and Usage

The contextmenu attribute specifies the context menu of an element. When the user right-clicks on the element, the context menu is displayed.
The value of the contextmenu attribute is the ID of the <menu> element to be opened.

HTML 4.01 and HTML5difference between

The contextmenu attribute is an HTML5 new attribute in the middle of.

Syntax

        <element contextmenu="menu_id">

Attribute Value

ValueDescription
menu_idThe id of the <menu> element to be opened.


Globale Attribute von HTML