Results 1 to 4 of 4

Thread: event.keyCode

  1. #1
    David Borland Guest

    Default event.keyCode

    Is there a bug in IE 4 with the event.keyCode? When I type the period., it returns (46 or 45, I forget which) which is the same code as when I hit the delete key. I created an event handler on the keypress and keydown, so I only allow certain characters to be typed into a numeric field but it&#039s hard to disallow periods if that&#039s the same code returned for the delete key which I want to allow.<BR><BR>Thanks. David

  2. #2
    jason Guest

    Default RE: event.keyCode

    never seen it myself, but it could be version related. generally i try to stay away from punctuation characters and special keys when using this sort of stuff, what&#039s the app?

  3. #3
    Join Date
    Dec 1969

    Default RE: event.keyCode

    am running IE 5.0 and when I press the delete key I get 46 and when I press the period key on the 10 key pad I get 110 but period on the keyboard gives me 190

  4. #4
    David Borland Guest

    Default RE: event.keyCode

    It appears to work correctly in IE5, IE4 has the problem.<BR><BR>In the application, we have numeric fields for where sometimes I want only 0-9, sometimes I also want to allow a decimal point, and sometimes I want to allow a minus sign. So I wrote several event handlers that looks at the event.keyCode and either passes the event key though or cancels it. I was trying to avoid having to do validation when they left the field (which is a subject of a nearby thread).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts