The event object gives you information about an event that has occurred.
事件对象提供关于事件发生的信息
Examples举例
Which mouse button was clicked?
哪个按钮被点了?
What are the coordinates of the cursor?
游标的坐标?
What is the unicode of the key pressed?
按键的unicde为?
What are the coordinates of the cursor, relative to the screen?
游标相对于屏幕的坐标?
What are the coordinates of the cursor?
游标的坐标
Was the shift key pressed?
shift按键是否按下
Which element was clicked?
哪个元素被点击了?
Which eventype occured?
发生了哪种类型的事件?
Event Object
事件对象
The Event object represents the state of an event, such as the element in which the event occurred, the state of the keyboard keys, the location of the mouse, and the state of the mouse buttons.
事件对象代表着一个事件的状态,譬如发生事件的元素,键盘按键的状态,鼠标按钮的状态。
The event object is available only during an event - that is, you can use it in event handlers but not in other code.
事件对象只有在可以使用事件处理而不是其他代码处理时才会有效。
In VBScript, you must access the event object through the window object.
在VBS里,你必须通过window对象来访问事件对象
The Event object's collections, properties and events are described below:
下面是有关事件对象的集合,属性以及事件的描述:
IE: Internet Explorer, F: Firefox, N: Netscape, W3C: World Wide Web Consortium (Internet Standard).
Collections集合
Collection | Description | IE | F | N | W3C |
---|---|---|---|---|---|
bookmarks[] | Returns a collection of bookmarks connected to the rows affected by the events | ||||
boundElements[] | Returns a collection of all elements on a page which are bound to a data test |
Properties属性
Property | Description | IE | F | N | W3C |
---|---|---|---|---|---|
Abstract | Returns the Abstract content in an Advanced Stream Redirector (ASX) file | 6 | |||
altKey | Sets or returns a Boolean value that indicates the state of the ALT key | 4 | |||
altLeft | Returns a Boolean value that indicates the state of the left ALT key | 5 | |||
banner | Returns the Banner content in an ASX file | 6 | |||
button | Sets or returns the mouse button pressed by the user
| 4 | |||
cancelBubble | Sets or returns a Boolean value that indicates whether or not the current event should bubble up the hierarchy of event handlers | 4 | |||
clientX | Sets or returns the x-coordinate of the mouse pointer - relative to the screen, excluding decorations and scroll bars | 4 | |||
clientY | Sets or returns the y-coordinate of the mouse pointer - relative to the screen, excluding decorations and scroll bars | 4 | |||
contentOverflow | 5 | ||||
ctrlKey | Sets or returns a Boolean value that indicates the state of the CTRL key | 4 | |||
ctrlLeft | Sets or returns a Boolean value that indicates the state of the left CTRL key | 5 | |||
dataFld | Sets or returns the data column affected by the oncellchange event | 5 | |||
fromElement | Sets or returns the object from which activation or the mouse pointer is exiting during the event | 4 | |||
keyCode | Sets or returns the UNICODE of the key pressed | 4 | |||
MoreInfo | Returns the MoreInfo content in an ASX file | 6 | |||
nextPage | Returns the position of the next page within a print template | 5 | |||
offsetX | Sets or returns the x-coordinate of the mouse pointer relative to the object firing the event | 4 | |||
offsetY | Sets or returns the y-coordinate of the mouse pointer relative to the object firing the event | 4 | |||
propertyName | Sets or returns the name of the property that has changed on the object | 5 | |||
qualifier | 5 | ||||
reason | Sets or returns the result of a data transfer for a data source
| 4 | |||
recordset | Sets or returns a reference to the default record set in a data source | 4 | |||
repeat | Returns a Boolean value that indicates whether the ONKEYDOWN event is being repeated | 5 | |||
returnValue | Sets or returns the return value from an event | 4 | |||
saveType | Returns the clipboard type when ONCONTENTSAVE fires | 5 | |||
screenX | Sets or returns the x-coordinate of the mouse pointer - relative to the screen | 4 | |||
screenY | Sets or returns the y-coordinate of the mouse pointer - relative to the screen | 4 | |||
shiftKey | Returns a Boolean value that indicates the state of the SHIFT key | 4 | |||
shiftLeft | Returns a Boolean value that indicates the state of the left SHIFT key | 5 | |||
srcElement | Sets or returns the object that fired the event | 4 | |||
srcFilter | Sets or returns the filter object that fired the ONFILTERCHANGE event | 4 | |||
srcUrn | Sets or returns the Universal Resource Name (URN) of the behavior that fired the event | 5 | |||
toElement | Sets or returns a reference to the object toward which the user is moving the mouse pointer | 4 | |||
type | Sets or returns the event name | 4 | |||
userName | 5 | ||||
wheelDelta | Returns the distance and the direction the wheel button has rolled | 5 | |||
x | Sets or returns the x-coordinate (in px) of the mouse pointer - relative to a relatively positioned parent element | 4 | |||
y | Sets or returns the y-coordinate (in px) of the mouse pointer - relative to a relatively positioned parent element | 4 |