HTML5中的ContextMenu属性

ContextMenu属性用于创建HTML文档中任何元素的上下文菜单。
用户右键单击元素时会出现上下文菜单。
ContextMenu在HTML5中是新的。

如何在HTML5中使用ContextMenu属性

HTML5中的ContextMenu属性例子

<html>

<body>

    

        右键点击其中查看菜单
    

    <menu id="menu">

        <command label="Open">

  <command label="Edit" >

  <command label="Delete" >

  <command label="Rename" >

    </menu>

</body>

</html>

HTML5中的ContextMenu属性语法

<ElementName contextmenu="menuid">
日期:2020-04-11 23:04:08 来源:oir作者:oir