Event Handling

"Claus Mygind" <[email protected]>
Newsgroups gmane.comp.mozilla.devel.java
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
I am having some trouble tracking key code events.  I can get it to work in
IE but not in Fire Fox.

<INPUT TYPE="text" NAME="LookUpKey" onkeyup = FindMatch()>

This calls the function "FindMatch()"

function FindMatch(evt) {

//this next line should detect either the IE window object property or the
W3C DOM event object as a parameter.  However it comes up null in FireFox.

   evt = (evt) ? evt : ((window.event) ? event : null);

//as a result this next line crashes because evt = null and has no
properties.

   var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ?
evt.keyCode : ((evt.which) ? evt.which : 0));
   if (evt) {
      if ((charCode > 64 && charCode < 91) || charCode == 8 || charCode ==
32) {

As you can see from the code I want to trap alpha char, space and backspace
keys only.  Any suggestions?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.