ÍøÂçѧԺ w3popÉçÇø ÍøÂç×ÊÔ´ ITÐÂÎÅ

w3pop.com :: ÍøÂçѧԺ :: HTML DOM :: DOM ʼþ

»áÔ±µÇ½

ÕʺÅ

ÃÜÂë

»Ø´ð

¼ÇסÃÜÂë

Íü¼ÇÃÜÂë? ×¢²á

HTML DOM
DOM ½éÉÜ
HTML DOM ¾ÙÀý
DOM ²Î¿¼
DOM ÕªÒª
HTML DOM ʵÀý
DOM Anchor
DOM Applet
DOM Area
DOM Base ¶ÔÏó
DOM Basefont¶ÔÏó
DOM Body ¶ÔÏó
DOM Document ¶ÔÏ..
DOM ʼþ
DOM Form ¶ÔÏó
DOM Frame ¶ÔÏó
DOM Frameset ¶ÔÏ..
DOM History
DOM Iframe ¶ÔÏó
DOM Image ¶ÔÏó
HTML DOM Button¶..

DOM ʼþ


×÷Õß:w3pop.com ·­Òë/ÕûÀí:w3pop.com ·¢²¼:2007-04-28 ä¯ÀÀ:7862 :: ::

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      

ÆÀÂÛ (1) 1 All