How do I prevent page from scrolling in IE

How do I prevent page from scrolling in IE

Hi,
I am making a game using the gameQuery library.
The game is contained in an iframe and everything works fine in any other browser than IE.

The iframe has it's own js that handles the whole game logic.

I need the controls to be with the arrows.

Here is all I've tried to prevent it from scrolling.

This js is included in the containing page :

  1. $(document).keypress(function(e)
  2. {
  3.     console.log("keypress_SCROLLS");
  4.     e.stopPropagation();
  5.     e.preventDefault();
  6.     return false;
  7. });
  8. $(document).keydown(function(e)
  9. {
  10.     console.log("keydown_SCROLLS");
  11.     e.stopPropagation();
  12.     e.preventDefault();
  13.     return false;
  14. });
  15. $(document).keyup(function(e)
  16. {
  17.     console.log("keyup_SCROLLS");
  18.     e.stopPropagation();
  19.     e.preventDefault();
  20.     return false;
  21. });
And here is the event handling from js handling the game logic and that is included in the iframe :

Note : KEY_XXXX are ints with keycodes and browserNeedsHelp is a boolean to know whether it's IE or not.

  1.     $(document).keypress(function(e){
  2.         e.stopPropagation();
  3.         e.preventDefault();
  4.   if(browserNeedsHelp)
  5.   {
  6.            
  7.    console.log("KEYPRESS");
  8.  
  9.    window.clearTimeout(keysTimeout);
  10.   
  11.    keysTimeout = setTimeout( "resetKeys()", 65);
  12.   }
  13.        
  14.  });
  15.     $(document).keydown(function(e){
  16.         if(!gameOver)
  17.         {
  18.             console.log("keydown");
  19.             e.stopPropagation();
  20.             e.preventDefault();
  21.             switch(e.keyCode)
  22.             {
  23.                 case KEY_LEFT:
  24.                     if(!animationSet)
  25.                     {
  26.                         animationSet = true;
  27.                         $("#player").setAnimation( playerAnims['going_left'] );
  28.                     }
  29.                     return false;
  30.                
  31.                 case KEY_UP:
  32.                     if(!animationSet)
  33.                     {
  34.                         animationSet = true;
  35.                         $("#player").setAnimation( playerAnims['going_up'] );
  36.                     }
  37.                     return false;
  38.                    
  39.                 case KEY_DOWN:
  40.                     if(!animationSet)
  41.                     {
  42.                         animationSet = true;
  43.                         $("#player").setAnimation( playerAnims['going_down'] );
  44.                     }
  45.                     return false;
  46.                    
  47.                 case KEY_RIGHT:
  48.                     if(!animationSet)
  49.                     {
  50.                         animationSet = true;
  51.                         $("#player").setAnimation( playerAnims['going_right'] );
  52.                     }
  53.                     return false;
  54.             }
  55.         }
  56.     });
  57.     $(document).keyup(function(e){
  58.             console.log("keyup");
  59.             e.stopPropagation();
  60.             e.preventDefault();
  61.             switch(e.keyCode)
  62.             {
  63.                 case KEY_LEFT:
  64.                     animationSet = false;
  65.                     $("#player").setAnimation( playerAnims['idle'] );
  66.                 return false;
  67.                
  68.                 case KEY_UP:
  69.                     animationSet = false;
  70.                     $("#player").setAnimation( playerAnims['idle'] );
  71.                 return false;
  72.                    
  73.                 case KEY_DOWN:
  74.                     animationSet = false;
  75.                     $("#player").setAnimation( playerAnims['idle'] );
  76.                 return false;
  77.                    
  78.                 case KEY_RIGHT:
  79.                     animationSet = false;
  80.                     $("#player").setAnimation( playerAnims['idle'] );
  81.                 return false;
  82.             }
  83.     });
Nothing of all this is working for some reason that I can't figure out, maybe the iframe is interfering I don't know...