spacer

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

home / experts / javascript / column10


The Event Object

Developer News
Google Chrome Playing Catch-Up on Extensions
Open Solutions Alliance Gets New Leadership
Red Hat Spacewalk Expands Linux Management

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.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

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

webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
MS Access and MySQL · Cisco AutoQoS: VoIP QoS for Mere Mortals · While VoIP Adoption Explodes in Enterprise, Carrier Spending Lags


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

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