HTML <menuitem> 標籤
實例
包含不同 <menuitem> 元素的上下文菜單:
<menu type="context" id="mymenu"> <menuitem label="Refresh" onclick="window.location.reload();" icon="ico_reload.png"> </menuitem> <menu label="Share on..."> <menuitem label="Twitter" icon="ico_twitter.png" onclick="window.open('//twitter.com/intent/tweet?text='+window.location.href);"> </menuitem> <menuitem label="Facebook" icon="ico_facebook.png" onclick="window.open('//facebook.com/sharer/sharer.php?u='+window.location.href);"> </menuitem> </menu> <menuitem label="Email This Page" onclick="window.location='mailto:?body='+window.location.href;"></menuitem> </menu>
瀏覽器支援
IE | Firefox | Chrome | Safari | Opera |
---|---|---|---|---|
Firefox 8.0 以及更高的版本支援 <menuitem> 標籤。
定義和用法
<menuitem> 標籤定義會員可以從彈出菜單呼叫的命令/菜單專案。
HTML 4.01 與 HTML 5 之間的差異
<menuitem> 標籤是 HTML5 中的新標籤。
屬性
new : HTML5 中的新屬性。
屬性 | 值 | 描述 |
---|---|---|
checked | checked | 規定在頁面載入后選中命令/菜單專案。 僅適用於 type="radio" 或 type="checkbox"。 |
default | default | 把命令/菜單項設定為預設命令。 |
disabled | disabled | 規定命令/菜單項應該被禁用。 |
icon | URL | 規定命令/菜單項的圖示。 |
open | open | 定義 details 是否可見。 |
label | text | 必需。規定命令/菜單項的名稱,以向用戶顯示。 |
radiogroup | groupname | 規定命令組的名稱,命令組會在命令/菜單項本身被切換時進行切換。 僅適用於 type="radio"。 |
type |
|
規定命令/菜單項的型別。預設是 "command"。 |
全域性屬性
<menuitem> 標籤支援 HTML 中的全域性屬性。
事件屬性
<menuitem> 標籤支援 HTML 中的事件屬性。
相關頁面
HTML DOM 參考手冊:MenuItem 對像