Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Capture Events


Message #1 by "Mark Irvine" <mark@m...> on Tue, 24 Apr 2001 14:40:50
Where did you find the line:
    document.captureEvents(Event.KEYPRESS);

I think it's completely bogus. Remove it, and everything works just fine.


Cheers,
Anil


----- Original Message -----
From: "Mark Irvine" <mark@m...>
To: "javascript" <javascript@p...>
Sent: Tuesday, April 24, 2001 2:40 PM
Subject: [javascript] Capture Events


> Hi there,
>
> I have been trying to capture certian keystrokes made by the user, namely
> the return key for form submission.  Located below is the code I intend to
> use, at the moment it simply alerts back the keystroke - however it does
> not appear to work.  I get an error message saying that 'Event' is
> undefined?  Just for the record I am using IE5.5 and have placed the code
> in the body part of the document.
>
> <script language="JavaScript1.2">
> function blockA(e)
> {
> var keyChar = String.fromCharCode(window.event.keyCode);
> alert(keyChar);
> }
> document.captureEvents(Event.KEYPRESS);
> document.onkeypress = blockA;
> </script>
>
> Hope someone can help,
>
> Mark

  Return to Index