Prevent Certain Key Presses

Results 1 to 2 of 2

Thread: Prevent Certain Key Presses

  1. #1
    Join Date
    Dec 1969

    Default Prevent Certain Key Presses

    I am trying to prevent the user from using the Alt + Right Arrow, Alt + Left Arrow and F11 keys.<BR><BR>I am only developing on Internet Explorer 5.5 and above. I have managed to stop them using the Alt key alone, but when its combined with the arrow keys my solution has no effect. I have also looked to use Event.ALT_MASK but it seems this is only suitable for Netscape Navigator.<BR><BR>Thanks in advance for any help

  2. #2
    Join Date
    Dec 1969

    Default RE: Prevent Certain Key Presses

    Put this on the document, add an alert to figureout what key number to look for....<BR><BR>document.onkeypress = onKeyPress;<BR>function onKeyPress () {<BR> var keycode;<BR> if (window.event) keycode = window.event.keyCode;<BR> else if (e) keycode = e.which;<BR> else return true;<BR> if (keycode == 13 &#124&#124 keycode == 40 &#124&#124 keycode == 41 &#124&#124 keycode == 43 &#124&#124 keycode == 34 ) {<BR> return false<BR>}<BR> return true <BR>}

Posting Permissions

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