View Single Post
Old 10-04-2012, 07:11 PM   PM User | #1
anotherJEK
Regular Coder

 
Join Date: Aug 2010
Location: Now Southern Oregon. I was born and had lived my life in Los Angeles until relocating last year (2010)
Posts: 152
Thanks: 41
Thanked 1 Time in 1 Post
anotherJEK is an unknown quantity at this point
prevent arraw key scrolling in IE?

I have an app that registers event handlers for keydown and looks for keyCode for arrow keys on keyboard. The problem is that the default action is to scroll the window if there is overflow. This is not necessary or useful in this application, and is a distraction.

How do I use returnValue to prevent this default action?
Or do I also need cancelBubble = true?

Code:
                else if(document.attachEvent)
                  {
                   document.attachEvent('onkeydown', function() { if(OBJ.gameOn) OBJ.keySwap(window.event, OBJ); });
                   window.event.returnValue = false; //// this does not seem to  do it.
                   window.event.cancelBubble = true; //// nor this
                  }
Thank you for time and attention.
anotherJEK is offline   Reply With Quote