diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/mouseevent/which | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/mouseevent/which')
-rw-r--r-- | files/zh-cn/web/api/mouseevent/which/index.html | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/mouseevent/which/index.html b/files/zh-cn/web/api/mouseevent/which/index.html new file mode 100644 index 0000000000..591412dda3 --- /dev/null +++ b/files/zh-cn/web/api/mouseevent/which/index.html @@ -0,0 +1,99 @@ +--- +title: MouseEvent.which +slug: Web/API/MouseEvent/which +tags: + - API + - 只读 + - 非标准 + - 鼠标事件 +translation_of: 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> |