网络浏览器: Difference between revisions

T (talk | contribs)
T (talk | contribs)
Line 77: Line 77:
In order to set both at the same time (without either resetting to 0), use <em>window.scrollTo</em>.
In order to set both at the same time (without either resetting to 0), use <em>window.scrollTo</em>.


=== Events ===
=== 事件 ===
==== Key Events ====
==== 按键事件 ====
The following buttons trigger the <em>onkeydown</em>, <em>onkeypress</em> and <em>onkeyup</em> events:
以下按钮会触发<em>onkeydown</em>事件,<em>onkeypress</em>事件 和 <em>onkeyup</em>事件:


{|class="wikitable" width="20%"
{|class="wikitable" width="20%"
! Code !! Button
! !! 按键
|-
|-
| 13 || A
| 13 || A
|-
|-
| 37 || Left
| 37 ||
|-
|-
| 38 || Up
| 38 || Up
|-
|-
| 39 || Right
| 39 ||
|-
|-
| 40 || Down
| 40 ||
|}
|}


The events cannot have their default action cancelled.  Other buttons do not trigger key events.
这些事件不能取消他们的默认动作。其他按钮不能触发按键事件。


==== Touch/Mouse Events ====
==== 触摸/鼠标事件 ====
<em>onmousedown</em>, <em>onmouseup</em> & <em>onclick</em> are all triggered by the browser.  However, the <em>onmousedown</em> event doesn't trigger until you lift the stylus or you've held it on the screen for ~2 seconds—which is when text selection mode is activated—making it pretty much the same as <em>onmouseup</em>.  The events cannot have their default action cancelled.
<em>onmousedown</em>, <em>onmouseup</em> & <em>onclick</em> 都是浏览器触发的事件。但是<em>onmousedown</em>事件只有你抬起手写笔,或者长按两秒以上才会发生。屏幕上的文本选择模式被激活时,这和<em>onmouseup</em>事件的效果相同。这些事件也不能取消默认动作。


The <em>onmousemove</em> and common touch/gesture events are not supported.
<em>onmousemove</em> 和触摸、手势事件不被支持。


== 屏幕分辨率 ==
== 屏幕分辨率 ==