Javascript Reference
Categories: event

javascript event Description

@Aug. 15, 2009, 12:09 p.m.
event Firefox/Netscape/NN 4 IE 4 Chrome/Safari/DOM 2

 

 

The event object contains information about a user- or system-generated event. But there are three different kinds of event objects, one for each of the event object models deployed in browsers: IE for Windows, Navigator 4, and Netscape 6 (from the W3C DOM). IE 5 for Macintosh implements a hybrid of the IE for Windows and Netscape 6 version. It is rare that an event object property applies to more than one of the event models, so pay special attention to the browser compatibility listings for each of the following properties.

 

The Netscape 6 event object is more complex in some ways due to the object-oriented nature of the underlying W3C DOM Event object structure. Rather than being an all-encompassing object (as the IE event object is), the Netscape 6 event object exposes different sets of properties and methods depending on the classification of event. All event classes share the properties and methods of the W3C DOM root Event object. But actual event object instances belong to one of the Event object's subclasses (and sometimes, sub-subclasses). These subclasses are known as UIEvent (so-called user interface events such as DOMFocusIn), MouseEvent (including the well-known mouse events), MutationEvent (events that signal a scripted change to the node structure of the document), and, coming in DOM Level 3, TextEvent (keyboard-related events). Netscape 6 implements its own, temporary keyboard events classification under the name KeyEvent, which is a subclass of UIEvent, although it borrows some MouseEvent properties for scripting convenience.

 

By and large, this functional division of objects won't impact your Netscape 6 event processing because an event listener function for a particular kind of event will be looking for properties associated with that event. The event class is of little concern. Still, it is instructive to see the way event object properties and methods cascade through this object-oriented structure. The following table illustrates the distribution of properties among Netscape 6 and W3C DOM event classes.

 

And the following table illustrates the distribution of methods among Netscape 6 and W3C DOM event classes.

 

The event object in Netscape 6 also implements the properties of the Navigator 4 static Event object, and it inherits an enormous list of W3C DOM TextEvent object constants that represent nonalphanumeric keyboard key codes (which have constant names like eventObject.DOM_VK_PAGE_UP). These keyboard constants are defined in the forthcoming W3C DOM Level 3 events module, but are already implemented in Netscape 6 (although the values don't exactly line up yet). A list of properties for the Navigator 4 static Event object appears in the Event object discussion following the current foray through an instance of an event.

 

You must use different script techniques to obtain a reference to an event object in the IE and Navigator event models. Once you have that reference, you are well on your way to equalizing event processing across browsers. The example fragments that follow assume that previous script statements have obtained a reference to the browser-specific event object (usually shown in the example as stored in a variable called evt).

 
  Event UIEvent MouseEvent KeyEventImplemented in Netscape 6 for additional functionality or in lieu of unfinished DOM Level 3 keyboard event model. Borrows some MouseEvent properties for scripting convenience. TextEventProposed for DOM Level 3, but not implemented in Netscape 6. MutationEvent
Event properties
bubbles
cancelable
cancelBubble IE property implemented in Netscape 6 for cross-browser convenience.  
currentTarget
eventPhase
originalTarget8  
target
timeStamp
type
UIEvent properties
detail    
view    
MouseEvent properties
altKey        
button          
clientX        
clientY        
ctrlKey        
metaKey        
relatedTarget          
screenX        
screenY        
shiftKey        
KeyEvent properties
charCode8          
isChar8          
keyCode8          
rangeOffset8          
rangeParent8          
TextEvent properties            
keyVal9          
numPad9          
outputString9          
virtKeyVal9          
visibleOutputGenerated9          
MutationEvent properties
attrChange          
attrName          
newValue          
prevValue          
relatedNode          
 
  Event UIEvent MouseEvent KeyEventImplemented in Netscape 6 for additional functionality or in lieu of unfinished DOM Level 3 keyboard event model. Borrows some MouseEvent properties for scripting convenience. TextEventProposed for DOM Level 3, but not implemented in Netscape 6. MutationEvent
Event methods
initEvent( )
getPreventDefault( )11  
preventDefault( )
stopPropagation( )
UIEvent methods
initUIEvent( )          
MouseEvent methods
initMouseEvent( )          
KeyEvent methods
initKeyEvent( )          
TextEvent methods
checkModifier( )12          
initModifier( )12          
initTextEvent( )12          
MutationEvent methods
initMutationEvent( )          
 
Object Model Reference
 
  • eventObj
  • [window.]event
 
Object-Specific Properties
 
altKey altLeft attrChange attrName
behaviorCookie behaviorPart bookmarks boundElements
bubbles button cancelable cancelBubble
charCode clientX clientY contentOverflow
ctrlKey ctrlLeft currentTarget data
dataFld dataTransfer detail eventPhase
fromElement isChar keyCode layerX
layerY metaKey modifiers newValue
nextPage offsetX offsetY originalTarget
pageX pageY prevValue propertyName
qualifier rangeOffset rangeParent reason
recordset relatedNode relatedTarget repeat
returnValue screenX screenY shiftKey
shiftLeft srcElement srcFilter srcUrn
target timeStamp toElement type
view wheelDelta which x
y      
 
Object-Specific Methods
 
getPreventDefault( ) initEvent( ) initKeyEvent( ) initMouseEvent( )
initMutationEvent( ) initUIEvent( ) preventDefault( ) stopPropagation( )
 
Object-Specific Event Handler Properties

None.

バイアグラ通販おすすめ - <a href="https://jpedpharm.com/">シルデナフィルジェネリック 通販</a> シアリス は通販での購
Saxoah - 28 hours
プレドニン おすすめ - <a href="https://jpaonlinep.com/jazithromycin/">ジスロマックジェネリック 通販</a> アジスロマイシン錠 500mg 強さ
Elfmhe - 32 hours
order cabergoline 0.25mg pills - <a href="https://adostilin.com/alesse/">alesse price</a> alesse sale
Gzpciu - 1 weeks

Powered by Linode.