MDN may have intermittent access issues April 18 13:00 - April 19 01:00 UTC. See whistlepig.mozilla.org for all notifications.

mozilla

Revision 651709 of <menuitem>

  • リビジョンの URL スラグ: Web/HTML/Element/menuitem
  • リビジョンのタイトル: <menuitem>
  • リビジョンの ID: 651709
  • 作成日:
  • 作成者: dhodder
  • 現行リビジョン いいえ
  • コメント Currently in W3C HTML 5.1, rather than 5.0

このリビジョンの内容

{{ SeeCompatTable() }}

Summary

The menuitem element represents a command which the user can invoke.

  • Content categories None.
  • Permitted content None, this is a void element.
  • Tag omission The start tag is mandatory, but, as it is a void element, the use an end tag is forbidden.
  • Permitted parent elements {{HTMLElement("menu")}} only. The type attribute of {{HTMLElement("menu")}} must be popup. (The missing value default of the attribute is popup.)
  • DOM interface {{domxref("HTMLMenuItemElement")}}

Attributes

This element includes the global attributes.

{{htmlattrdef("checked")}}
Indicates whether the command is selected. Must be omitted unless the type attribute is checkbox or radio.
{{htmlattrdef("command")}}
 
{{htmlattrdef("default")}}
 
{{htmlattrdef("disabled")}}
Indicates that the command is not available.
{{htmlattrdef("icon")}}
Gives a picture which represents the command.
{{htmlattrdef("label")}}
The name of the command as shown to the user.
{{htmlattrdef("radiogroup")}}
This attribute gives the name of the group of commands, with a type of radio, that will be toggled when the command itself is toggled. This attribute must be omitted unless the type attribute is radio.
{{htmlattrdef("type")}}
This attribute indicates the kind of command. This can be one of three values.
  • command or empty which is the default state and indicates that this is a normal command.
  • checkbox indicates that the command can be toggled using a checkbox.

  • radio indicates that the command can be toggled using a radiobutton.

Examples

<menuitem type="command" label="Save" icon="icons/save.png" onclick="save()">

Specifications

Specification Status Comment
{{SpecName('HTML WHATWG', 'interactive-elements.html#the-menuitem-element', '<menuitem>')}} {{Spec2('HTML WHATWG')}}  
{{SpecName('HTML5.1', 'interactive-elements.html#the-menuitem-element', '<menuitem>')}} {{Spec2('HTML5.1')}}  

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatUnknown}} {{CompatGeckoDesktop(8)}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatUnknown}} {{CompatGeckoMobile(8)}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}

See also

{{ HTMLRef }}

このリビジョンのソースコード

<p>{{ SeeCompatTable() }}</p>
<h2 id="Summary">Summary</h2>
<p>The <code>menuitem</code> element represents a command which the user can invoke.</p>
<ul class="htmlelt">
 <li><dfn><a href="/en-US/docs/Web/HTML/Content_categories">Content categories</a></dfn> None.</li>
 <li><dfn>Permitted content</dfn> None, this is a void element.</li>
 <li><dfn>Tag omission</dfn> The start tag is mandatory, but, as it is a void element, the use an end tag is forbidden.</li>
 <li><dfn>Permitted parent elements</dfn> {{HTMLElement("menu")}} only. The <code>type</code> attribute of {{HTMLElement("menu")}} must be <code>popup</code>. (The missing value default of the attribute is <code>popup</code>.)</li>
 <li><dfn>DOM interface</dfn> {{domxref("HTMLMenuItemElement")}}</li>
</ul>
<h2 id="Attributes">Attributes</h2>
<p>This element includes the <a href="/en-US/docs/Web/HTML/Global_attributes">global attributes</a>.</p>
<dl>
 <dt>
  {{htmlattrdef("checked")}}</dt>
 <dd>
  Indicates whether the command is selected. Must be omitted unless the <code>type</code> attribute is <code>checkbox</code> or <code>radio</code>.</dd>
 <dt>
  {{htmlattrdef("command")}}</dt>
 <dd>
  &nbsp;</dd>
 <dt>
  {{htmlattrdef("default")}}</dt>
 <dd>
  &nbsp;</dd>
 <dt>
  {{htmlattrdef("disabled")}}</dt>
 <dd>
  Indicates that the command is not available.</dd>
 <dt>
  {{htmlattrdef("icon")}}</dt>
 <dd>
  Gives a picture which represents the command.</dd>
 <dt>
  {{htmlattrdef("label")}}</dt>
 <dd>
  The name of the command as shown to the user.</dd>
 <dt>
  {{htmlattrdef("radiogroup")}}</dt>
 <dd>
  This attribute gives the name of the group of commands, with a <code>type</code> of <code>radio</code>, that will be toggled when the command itself is toggled. This attribute must be omitted unless the <code>type</code> attribute is <code>radio</code>.</dd>
 <dt>
  {{htmlattrdef("type")}}</dt>
 <dd>
  This attribute indicates the kind of command. This can be one of three values.
  <ul>
   <li><code>command</code> or empty which is the default state and indicates that this is a normal command.</li>
   <li>
    <p><code>checkbox</code> indicates that the command can be toggled using a checkbox.</p>
   </li>
   <li><code>radio</code> indicates that the command can be toggled using a radiobutton.</li>
  </ul>
 </dd>
</dl>
<h2 id="Examples">Examples</h2>
<pre class="brush: html">
&lt;menuitem type="command" label="Save" icon="icons/save.png" onclick="save()"&gt;
</pre>
<h2 id="Specifications" name="Specifications">Specifications</h2>
<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('HTML WHATWG', 'interactive-elements.html#the-menuitem-element', '&lt;menuitem&gt;')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5.1', 'interactive-elements.html#the-menuitem-element', '&lt;menuitem&gt;')}}</td>
   <td>{{Spec2('HTML5.1')}}</td>
   <td>&nbsp;</td>
  </tr>
 </tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{CompatibilityTable}}</p>
<div id="compat-desktop">
 <table class="compat-table">
  <tbody>
   <tr>
    <th>Feature</th>
    <th>Chrome</th>
    <th>Firefox (Gecko)</th>
    <th>Internet Explorer</th>
    <th>Opera</th>
    <th>Safari</th>
   </tr>
   <tr>
    <td>Basic support</td>
    <td>{{CompatUnknown}}</td>
    <td>{{CompatGeckoDesktop(8)}}</td>
    <td>{{CompatUnknown}}</td>
    <td>{{CompatUnknown}}</td>
    <td>{{CompatUnknown}}</td>
   </tr>
  </tbody>
 </table>
</div>
<div id="compat-mobile">
 <table class="compat-table">
  <tbody>
   <tr>
    <th>Feature</th>
    <th>Android</th>
    <th>Firefox Mobile (Gecko)</th>
    <th>IE Mobile</th>
    <th>Opera Mobile</th>
    <th>Safari Mobile</th>
   </tr>
   <tr>
    <td>Basic support</td>
    <td>{{CompatUnknown}}</td>
    <td>{{CompatGeckoMobile(8)}}</td>
    <td>{{CompatUnknown}}</td>
    <td>{{CompatUnknown}}</td>
    <td>{{CompatUnknown}}</td>
   </tr>
  </tbody>
 </table>
</div>
<h2 id="See_also">See also</h2>
<ul>
 <li><a href="https://hacks.mozilla.org/2011/11/html5-context-menus-in-firefox-screencast-and-code/">HTML5 context menus in Firefox (Screencast and Code)</a></li>
</ul>
<p>{{ HTMLRef }}</p>
このリビジョンへ戻す