DOM 事件

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集合

CollectionDescriptionIEFNW3C
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属性

PropertyDescriptionIEFNW3C
AbstractReturns the Abstract content in an Advanced Stream Redirector (ASX) file6   
altKeySets or returns a Boolean value that indicates the state of the ALT key4   
altLeftReturns a Boolean value that indicates the state of the left ALT key5   
bannerReturns the Banner content in an ASX file6   
button Sets or returns the mouse button pressed by the user
  • 0 - Default. No button pressed
  • 1 - Left button pressed
  • 2 - Right button pressed
  • 3 - Left and right buttons pressed
  • 4 - Middle button pressed
  • 5 - Left and middle buttons pressed
  • 6 - Right and middle buttons pressed
  • 7 - All three buttons are pressed
     
4   
cancelBubble Sets or returns a Boolean value that indicates whether or not the current event should bubble up the hierarchy of event handlers4   
clientX Sets or returns the x-coordinate of the mouse pointer - relative to the screen, excluding decorations and scroll bars4   
clientY Sets or returns the y-coordinate of the mouse pointer - relative to the screen, excluding decorations and scroll bars4   
contentOverflow 5   
ctrlKey Sets or returns a Boolean value that indicates the state of the CTRL key4   
ctrlLeftSets or returns a Boolean value that indicates the state of the left CTRL key5   
dataFld Sets or returns the data column affected by the oncellchange event5   
fromElement Sets or returns the object from which activation or the mouse pointer is exiting during the event4   
keyCode Sets or returns the UNICODE of the key pressed4   
MoreInfoReturns the MoreInfo content in an ASX file6   
nextPageReturns the position of the next page within a print template5   
offsetX Sets or returns the x-coordinate of the mouse pointer relative to the object firing the event4   
offsetY Sets or returns the y-coordinate of the mouse pointer relative to the object firing the event4   
propertyName Sets or returns the name of the property that has changed on the object5   
qualifier 5   
reason Sets or returns the result of a data transfer for a data source
  • 0 - Successfully
  • 1 - Aborted
  • 2 - Error
4   
recordset Sets or returns a reference to the default record set in a data source4   
repeat Returns a Boolean value that indicates whether the ONKEYDOWN event is being repeated5   
returnValue Sets or returns the return value from an event4   
saveTypeReturns the clipboard type when ONCONTENTSAVE fires5   
screenX Sets or returns the x-coordinate of the mouse pointer - relative to the screen4   
screenY Sets or returns the y-coordinate of the mouse pointer - relative to the screen4   
shiftKey Returns a Boolean value that indicates the state of the SHIFT key4   
shiftLeftReturns a Boolean value that indicates the state of the left SHIFT key5   
srcElement Sets or returns the object that fired the event4   
srcFilter Sets or returns the filter object that fired the ONFILTERCHANGE event4   
srcUrn Sets or returns the Universal Resource Name (URN) of the behavior that fired the event5   
toElement Sets or returns a reference to the object toward which the user is moving the mouse pointer4   
typeSets or returns the event name4   
userName 5   
wheelDeltaReturns the distance and the direction the wheel button has rolled5   
xSets or returns the x-coordinate (in px) of the mouse pointer - relative to a relatively positioned parent element4   
ySets or returns the y-coordinate (in px) of the mouse pointer - relative to a relatively positioned parent element4   
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值