contextmenu=id - コンテキストメニューの指定

トップ > HTMLリファレンス > contextmenu=id

■ 属性

<タグ名 contextmenu=id> - コンテキストメニューの指定

■ 説明

HTML5 でサポート予定の属性で、コンテキストメニューを指定します。まだ、サポートブラウザは少ないようです。

■ 使用例

HTMLソース
<form name="npc">

 <label>Character name: <input name=char type=text contextmenu=namemenu required></label>
 <menu type=context id=namemenu>
  <command label="Pick random name" onclick="document.forms.npc.elements.char.value = getRandomName()">
  <command label="Prefill other fields based on name" onclick="prefillFields(document.forms.npc.elements.char.value)">
 </menu>

</form>

ブラウザ表示例
未稿

■ 関連項目

<menu><command>

Copyright (C) 2011 杜甫々
初版:2011年5月29日、最終更新:2011年5月29日
http://www.tohoho-web.com/html/attr/contextmenu.htm