Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











OBJECT:  Event


An Event object is created automatically by JavaScript on the occurrence of an event. It has various properties that provide information about the event such as event type, the position of the cursor at the time the event occurred , etc. Not all of the properties relate to every type of event; the ones that do are documented in the individual event handler pages.

The following example creates a button that, when clicked, displays an alert box showing the event type (in this case a 'click' event).

Code:
<input type="button" value="Event type" onClick='alert("The event type is " + event.type)'>


PROPERTIES

data Property Netscape Only Feature
This property relates to the DragDrop event and its use returns an array that contains the URLs of any dropped objects, as strings.

Syntax: event.data

height Property Netscape Only Feature
This property relates to the height of the window or frame that contains the object that initiated the event.

Syntax: event.height

layerX / layerY Property Netscape Only Feature
These properties returns a number that represents the horizontal/vertical position, in pixels, of the cursor relative to the layer that initiated the event, or, when passed with a resize event, it represents the object width/height. These properties are synonyms for, and interchangable with, the x and y event object properties.

Syntax: event.layerX
Syntax: event.layerY

modifiers Property Netscape Only Feature
This property returns a string containing details of any modifier keys that were held down during a key or mouse event. The values of the modifier keys are as follows: ALT_MASK, CONTROL_MASK, SHIFT_MASK and META_MASK.

Syntax: event.modifiers

pageX / pageY Property Netscape Only Feature
These properties return the horizontal/vertical position of the cursor relative to the page, in pixels, at the time the event occured.

Syntax: event.pageX
Syntax: event.pageY

screenX / screenY Property
These properties return the horizontal/vertical position of the cursor relative to the screen, in pixels, at the time the event occured.

Syntax: event.screenX
Syntax: event.screenY

target Property Netscape Only Feature
This property returns a reference to the object that the event was originally sent to.

Syntax: event.target

type Property
This property returns a string that represents the type of the event (click, key down, etc.).

Syntax: event.type

which Property Netscape Only Feature
This property returns a number that represents either which mouse button (1 being the left button, 2 the middle and 3 the right) was pressed or which key was pressed (its ASCII value) at the time the event occuered.

Syntax: event.which

width Property Netscape Only Feature
This property relates to the height of the window or frame that contains the object that initiated the event.

Syntax: event.width

x / y Property IE Only Feature
These properties returns a number that represents the horizontal/vertical position, in pixels, of the cursor relative to the layer that initiated the event, or, when passed with a resize event, it represents the object width/height. These properties are synonyms for, and interchangable with, the layerX and layerY event object properties.

Syntax: event.x
Syntax: event.y


METHODS

The Event object inherits the watch and unwatch methods of the Object object.

 


Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information