Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    wac
    wac is offline
    Regular Coder wac's Avatar
    Join Date
    Sep 2002
    Location
    Cary, North Carolina, USA
    Posts
    359
    Thanks
    2
    Thanked 0 Times in 0 Posts

    turnoff firefox find on keydown

    I'm trying to do an onkeydown in firefox but the keys keep getting used by the 'find' feature of fire fox. How do I turn this feature off so my keydown handler will get called???
    Wayne Christian

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    For yourself? It's in about:config, filter by "find". There's a few settings.
    For others? You don't.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    The browser settings always take priority over web page settings.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #4
    wac
    wac is offline
    Regular Coder wac's Avatar
    Join Date
    Sep 2002
    Location
    Cary, North Carolina, USA
    Posts
    359
    Thanks
    2
    Thanked 0 Times in 0 Posts
    how does one manipulate these configurations ?
    Wayne Christian

  • #5
    wac
    wac is offline
    Regular Coder wac's Avatar
    Join Date
    Sep 2002
    Location
    Cary, North Carolina, USA
    Posts
    359
    Thanks
    2
    Thanked 0 Times in 0 Posts
    well,
    after setting 'accessibility:typeaheadfind' back to the default (false), I still cannot get the following code to work in firefox. This code simply displays the keypress/keyup/keydown codes in the table. This works fine on IE, but does nothing on firefox. Please help

    Code:
    <html>
      <head>
        <title>Test key presses</title>
        <script type="text/javascript" src="../scripts/utils.js" ></script>
        <script type='text/javascript'>
          function keypress(event)
          {
          var code = getEventKeyCode(event) ;
          var elem = document.getElementById('keypress') ;
            elem.innerHTML = ''+code ;
          }
          
          function keydown(event)
          {
          var code = getEventKeyCode(event) ;
          var elem = document.getElementById('keydown') ;
            elem.innerHTML = ''+code ;
          }
          function keyup(event)
          {
          var code = getEventKeyCode(event) ;
          var elem = document.getElementById('keyup') ;
            elem.innerHTML = ''+code ;
          }
        </script>
      </head>
      <body>
        <div style='border-style:outset;border-width:3;width:150;height:150'
            onkeypress='keypress(event)'
            onkeydown='keydown(event)'
            onkeyup='keyup(event)'
            >
    
          <table >
            <tr><td>Key Pressed:</td><td id='keypress'></td></tr>
            <tr><td>Key Down:</td><td id='keydown'></td></tr>
            <tr><td>Key Up:</td><td id='keyup'></td></tr>
          </table>
        </div>
      </body>
    
    </html>
    Wayne Christian

  • #6
    New to the CF scene
    Join Date
    Sep 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by wac View Post
    I'm trying to do an onkeydown in firefox but the keys keep getting used by the 'find' feature of fire fox. How do I turn this feature off so my keydown handler will get called???
    Here's how I was able to do it:
    Code:
    var stopDefaults = false;
    function keyDown(e) {
    //	alert(e.keyCode);
    	switch(e.keyCode) {
    		case 74:	scrollDn(); stopDefaults = true; break;
    		case 75:	scrollUp(); stopDefaults = true; break;
    		default:	stopDefaults = false; break;
    	}
    }
    function keyPress(e) {
    	if (stopDefaults) {
    		e.preventDefault();
    	}
    }
    window.document.addEventListener("keydown", keyDown, true);
    window.document.addEventListener("keypress", keyPress, true);
    - Guillaume Boudreau
    Last edited by gboudreau; 09-23-2006 at 04:12 PM.


  •  

    Posting Permissions

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