Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trapping events using captureEvents not working

Status
Not open for further replies.

pigsie

Programmer
Joined
Dec 19, 2000
Messages
307
Location
GB
Man am I having a bad time!

As far as I know the following code should work:

window.captureEvents (Event.CLICK|Event.FOCUS);
window.onclick=myHandler;
window.onfocus=HandleFocus;

function myHandler(e)
{
alert('test');
return false;
}

However as soon as the page loads - all I get is Event is undefined. I thought that Event.CLICK above was simply a constant indicating the type of event to trap?

Any light anyone could shed on this would be really appreciated.

Thanks
 
Depends what browser you're using. IE doesn't use this. Try this:
Code:
if( document.captureEvents ) {
  document.captureEvents (Event.CLICK|Event.FOCUS);
}
Look here for more info.

Adam
while(ignorance){perpetuate(violence,fear,hatred);life=life-1};
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top