spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column10


The Event Object

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

Internet Explorer 4.0x's event object is similar to the one in Navigator 4.0x. However, there are many differences between the two implementations.

The event object in Internet Explorer 4.0x is available only during an event. Therefore, you can only refer to it in event handler scripts and event processing functions. The event object is governed by the window object, so its formal syntax is window.event. The preceding window specification is not necessary in any version of JavaScript, so it may be omitted.

The event object represents the state of the event that is associated with the object at a given time, such as the element where the event occurred and the location of the mouse cursor.

The following example displays the current position of the mouse cursor (with respect to the browser window) in the status bar:

<SCRIPT LANGUAGE="JavaScript">
<!--

function displayLocation() {
  var str = "";
  str += "X=" + window.event.clientX;
  str += ", ";
  str += "Y=" + window.event.clientY;
  window.status = str; // display in status bar
}

document.onmousemove = displayLocation;

// -->
</SCRIPT>

If you're using Internet Explorer 4.0x, you've probably already noticed the running numbers in the status bar. We'll discuss the cross-browser version for this script and others in our next column, covering the "cross-browser event model."

http://www.internet.com

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business


Created: December 30, 1997
Revised: December 30, 1997

URL: http://www.webreference.com/js/column10/eventobject.html