为普通菜单点击事件添加快捷键:

<menubar>
<menu id="fileMenu" label="文件(F)" accesskey="F">
<menupopup id="file-popup">
<menuitem id="idm_close" label="关闭(X)" accesskey="X"/>
</menupopup>
</menu>
</menubar>
设置全局快捷键需要用到<key>标签,key标签被包含在一个<keyset>标签中:

<keyset>
<key id="key1" modifiers="control" key="Q" oncommand="alert('crtl+Q')"/>
<key id="key2" modifiers="control alt" key="C" oncommand="alert('crtl+alt+C')"/>
<key id="key3" keycode="VK_F6" oncommand="alert('F6')"/>
</keyset>
command元素:command元素关联一个命令,

<command id="cmd_openhelp" oncommand="alert('这是帮助');"/>
<button label="帮助" command="cmd_openhelp"/>
<button label="还是帮助" command="cmd_openhelp"/>
<button label="禁用帮助"
oncommand="document.getElementById('cmd_openhelp').setAttribute('disabled','true');"/>
<button label="激活帮助"
oncommand="document.getElementById('cmd_openhelp').removeAttribute('disabled');"/>