在 HTML5 中创建用户可从弹出菜单调用的命令/菜单项
htmlweb developmentfront end technology更新于 2024/7/25 9:16:17
使用 <menuitem> 标签创建用户可从 HTML5 弹出菜单调用的命令/菜单项。HTML <menuitem> 标签用于定义菜单的菜单项。
以下是 <menuitem> 标签的属性 −
| 属性 | 值 | 描述 |
|---|---|---|
| checked | checked | defines that a menuitem should be checked |
| default | default | a menuitem is marked as a default command |
| disabled | disabled | disables a menuitem and cannot be clicked |
| icon | url | defines an icon for a menuitem |
| label | text | defines a name for a menuitem which is displayed to the user |
| radiogroup | groupname | defines a group of commands out of which only one can be selected |
| type | checkbox command radio | defines type of command for a menuitem default is command |
示例
您可以尝试运行以下代码在 HTML5 中实现 <menuitem> 标签 −
<!Doctype html> <html> <head> <title>HTML menuitem Tag</title> </head> <body> <div style = "border:1px solid #000; padding:20px;" contextmenu = "clickmenu"> <p>Right click inside here....</p> <menu type = "context" id = "clickmenu"> <menuitem label = "Tutorialspoint" onclick = ""></menuitem> <menuitem label = "Tutorials Library" onclick = ""></menuitem> <menuitem label = "Coding Ground" onclick = ""></menuitem> <menuitem label = "Q/A" onclick = ""></menuitem> </menu> </div> </body> </html>
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

