当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > DOM 事件

HTML DOM
DOM Input Checkbox
DOM Input File 对象
DOM Input Hidden对象
DOM Input Password 对象
DOM Input Radio 对象
DOM Input Reset 对象
DOM Input Submit 对象
DOM Input Text 对象
DOM Link 对象
DOM Location 对象
DOM Meta 对象
DOM Navigator 对象
DOM 对象
DOM Option 对象
DOM Screen 对象
DOM Select 对象
DOM Style 对象
DOM Table 对象
DOM TableData 对象
DOM TableHeader 对象

HTML DOM 中的 DOM 事件


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 952 ::
收藏到网摘: n/a

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
event 对象获取高级流重定向器(ASX)文件中项目横幅的 Abstract 内容。
6      
altKey Sets or returns a Boolean value that indicates the state of the ALT key
设置或获取 Alt 键的状态。
4      
altLeft Returns a Boolean value that indicates the state of the left ALT key
设置或获取左 Alt 键的状态。
5      
banner Returns the Banner content in an ASX file
使用 event 对象获取高级流重定向器(ASX)文件中项目的 Banner 内容。
6      
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
    所有三个按钮同时被按
     
    firefox(版本2.0) 点击鼠标左中右键, event.button的值分别为0,1,2
    IE(版本6) 点击鼠标左中右键, event.button的值分别为 1,2,4

    参见:http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-MouseEvent
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
设置或获取鼠标指针位置相对于窗口客户区域的 x 坐标,其中客户区域不包括窗口自身的控件和滚动条。
4      
clientY Sets or returns the y-coordinate of the mouse pointer - relative to the screen, excluding decorations and scroll bars
设置或获取鼠标指针位置相对于窗口客户区域的 y 坐标,其中客户区域不包括窗口自身的控件和滚动条。
4      
contentOverflow  获取表明文档处理当前 LayoutRect 对象后是否包含附加的内容。 5      
ctrlKey Sets or returns a Boolean value that indicates the state of the CTRL key
设置或获取 Ctrl 键的状态。
4      
ctrlLeft Sets or returns a Boolean value that indicates the state of the left CTRL key
设置或获取左 Ctrl 键的状态。
5      
dataFld Sets or returns the data column affected by the oncellchange event
设置或获取 oncellchange 事件影响的数据列。
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
设置或获取与导致事件的按键关联的 Unicode 按键代码。
4      
MoreInfo Returns the MoreInfo content in an ASX file
通过 event 对象获取高级流重定向器(ASX)文件中项目横幅的 MoreInfo 内容。
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
设置或获取鼠标指针位置相对于触发事件的对象的 x 坐标。
4      
offsetY Sets or returns the y-coordinate of the mouse pointer relative to the object firing the event
设置或获取鼠标指针位置相对于触发事件的对象的 y 坐标。
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
设置或获取数据源对象的数据传输结果。
  • 0 - Successfully
    成功的
  • 1 - Aborted
    放弃的
  • 2 - Error
    错误的
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
获取 onkeydown 事件是否正在重复。
5      
returnValue Sets or returns the return value from an event
设置或获取事件的返回值。
4      
saveType Returns the clipboard type when ONCONTENTSAVE fires
当 oncontentsave 触发时获取剪贴板类型。
5      
screenX Sets or returns the x-coordinate of the mouse pointer - relative to the screen
设置或获取获取鼠标指针位置相对于用户屏幕的 x 坐标。
4      
screenY Sets or returns the y-coordinate of the mouse pointer - relative to the screen
设置或获取鼠标指针位置相对于用户屏幕的 y 坐标。
4      
shiftKey Returns a Boolean value that indicates the state of the SHIFT key
设置或获取 Shift 键的状态。
4      
shiftLeft Returns a Boolean value that indicates the state of the left SHIFT key
设置或获取左 Shift 键的状态。
5      
srcElement Sets or returns the object that fired the event
设置或获取触发事件的对象。
4      
srcFilter Sets or returns the filter object that fired the ONFILTERCHANGE event
设置或获取触发 onfilterchange 事件的滤镜对象。
4      
srcUrn Sets or returns the Universal Resource Name (URN) of the behavior that fired the event
获取触发事件的行为的统一资源名称(URN)。
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
从 event 对象中获取事件名称。
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
设置或获取鼠标指针位置相对于父文档的 x 像素坐标。
4      
y Sets or returns the y-coordinate (in px) of the mouse pointer - relative to a relatively positioned parent element
设置或获取鼠标指针位置相对于父文档的 y 像素坐标。
4      

评论 (0) All

登陆 | 还没注册?