包含不同 <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> 標(biāo)簽。
<menuitem> 標(biāo)簽定義用戶可以從彈出菜單調(diào)用的命令/菜單項目。
<menuitem> 標(biāo)簽是 HTML5 中的新標(biāo)簽。
new : HTML5 中的新屬性。
屬性 | 值 | 描述 |
---|---|---|
checked | checked | 規(guī)定在頁面加載后選中命令/菜單項目。 僅適用于 type="radio" 或 type="checkbox"。 |
default | default | 把命令/菜單項設(shè)置為默認(rèn)命令。 |
disabled | disabled | 規(guī)定命令/菜單項應(yīng)該被禁用。 |
icon | URL | 規(guī)定命令/菜單項的圖標(biāo)。 |
open | open | 定義 details 是否可見。 |
label | text | 必需。規(guī)定命令/菜單項的名稱,以向用戶顯示。 |
radiogroup | groupname | 規(guī)定命令組的名稱,命令組會在命令/菜單項本身被切換時進行切換。 僅適用于 type="radio"。 |
type |
|
規(guī)定命令/菜單項的類型。默認(rèn)是 "command"。 |
<menuitem> 標(biāo)簽支持 HTML 中的全局屬性。
<menuitem> 標(biāo)簽支持 HTML 中的事件屬性。
HTML DOM 參考手冊:MenuItem 對象
如對本文有疑問,請?zhí)峤坏浇涣髡搲瑥V大熱心網(wǎng)友會為你解答??! 點擊進入論壇