spacer

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

home / experts / javascript / column10


Capturing Events

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

Internet Explorer 4.0x doesn't provide an explicit function for capturing events at the window or document level. An event is captured by an object when the event reaches it, provided that the object has an event handler that processes the event. If the object doesn't have such an event handler, the event is released.

You may recall from Column 9 that Navigator 4.0x features two methods that capture and release events:

  • captureEvents()
  • releaseEvents()

In Internet Explorer 4.0x you simply need to specify an event processing function to capture an event. The following script segment captures all click events that occur on the document:

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

document.onclick = functionName;

// -->
</SCRIPT>

For example, if you put the following script in your HTML document, an alert dialog box pops up when you click anywhere on the document:

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

function processClicks() {
  alert("Thank you for clicking the mouse button.");
}

document.onclick = processClicks;

// -->
</SCRIPT>

http://www.internet.com

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

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

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint


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

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