diff options
Diffstat (limited to 'files/zh-cn/conflicting/web/api/uievent/which/index.html')
-rw-r--r-- | files/zh-cn/conflicting/web/api/uievent/which/index.html | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/files/zh-cn/conflicting/web/api/uievent/which/index.html b/files/zh-cn/conflicting/web/api/uievent/which/index.html new file mode 100644 index 0000000000..760958f975 --- /dev/null +++ b/files/zh-cn/conflicting/web/api/uievent/which/index.html @@ -0,0 +1,100 @@ +--- +title: MouseEvent.which +slug: conflicting/Web/API/UIEvent/which +tags: + - API + - 只读 + - 非标准 + - 鼠标事件 +translation_of: Web/API/MouseEvent/which +original_slug: Web/API/MouseEvent/which +--- +<p>{{APIRef("DOM Events")}}</p> + +<p>{{Non-standard_header}}</p> + +<p>只读属性 <strong>MouseEvent.which</strong> 显示了鼠标事件是由哪个鼠标按键被按下所触发的。其他获得该信息的标准属性是 {{ domxref("MouseEvent.button") }} 与 {{ domxref("MouseEvent.buttons") }} 。</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox">var buttonPressed = instanceOfMouseEvent.which +</pre> + +<h3 id="返回值">返回值</h3> + +<p>表示一个特定按键的数字:</p> + +<ul> + <li><code>0</code>: 无</li> + <li><code>1</code>: 左键</li> + <li><code>2</code>: 中间滚轮(如果有的话)</li> + <li><code>3</code>: 右键</li> +</ul> + +<p>如果鼠标被设置为适用于左利手人士使用,那么引发的动作恰好相反。在这种情况下,该值应该从右往左看。</p> + +<h2 id="规范">规范</h2> + +<p>无规范定义该属性。</p> + +<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</h2> + +<p>{{CompatibilityTable}}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Edge</th> + <th>Firefox (Gecko)</th> + <th>Chrome</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoDesktop(1)}}<sup>[1]</sup></td> + <td>1.0</td> + <td>9.0</td> + <td>5.0</td> + <td>1.0</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Edge</th> + <th>Firefox Mobile (Gecko)</th> + <th>Android</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{ CompatGeckoMobile(1) }} [1]</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<p>[1] 在 {{event("mousemove")}} 事件对象上, <code>which</code> 属性被错误地设定为 <code>1</code> {{bug(1048294)}}.</p> + +<h2 id="See_also" name="See_also">相关内容</h2> + +<ul> + <li>{{ domxref("MouseEvent") }}</li> +</ul> |