CLASSIC enter key fires tab action to focus on other ctrl not working in ff

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JeanLuc
    New Member
    • Sep 2010
    • 5

    CLASSIC enter key fires tab action to focus on other ctrl not working in ff

    Hi,the following code works in the latest version of IE but doesnt work in the latest version of FireFox. Tried everything on available on the web. Im using ASP.NET & VS2008 but have this code on the client:

    javascript:if (event.keyCode= =13) {event.keyCode= 9; return event.keyCode }

    Thanks.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    IE uses a different event model than all other browsers. put simply, there is no global event object in FF.

    the standard (DOM) defines that the event object is passed as first and only parameter in the executing function:
    Code:
    function test(evt)
    {
    	alert(evt.keyCode);
    }
    window.addEventListener("keydown", test, false);

    Comment

    • JeanLuc
      New Member
      • Sep 2010
      • 5

      #3
      You are AWESOME. THANKS! I was driving insane!

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        it doesn’t get better once you discover, what awesome stuff you can do with DOM3 Events.

        Comment

        • JeanLuc
          New Member
          • Sep 2010
          • 5

          #5
          yet, if i have window.addEvent Listener("keydo wn", Test, false); and the following, i cant throw a TAB action.

          Code:
                  function Test(evt) {
                      var keynum;
                      keynum = evt.which;
                      alert(keynum);
                      keynum = 9;
                      alert(keynum);
                      return keynum; 
                  }
          Any hints? Thanks.
          Last edited by Dormilich; Sep 3 '10, 02:15 PM. Reason: Please use [code] tags when posting code

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            what do you mean by "throw a tab action"?

            Comment

            • JeanLuc
              New Member
              • Sep 2010
              • 5

              #7
              Hi,what i want is that when a user presses ENTER key the focus goes to the next control in FireFox.
              If you press the TAB key in any page, you will see that the focus moves from control to control, i want to do that when a user presses the ENTER key. In IE i can capture the keyCode, i can see if its value is 13 (thats ENTER) and edit its value by a 9(thats TAB), so that i can then return the keyCode.
              Example:if (event.keyCode= =13) {event.keyCode= 9; return event.keyCode }

              Comment

              Working...