www.webdeveloper.com
Results 1 to 6 of 6

Thread: e.keyCode == 13 not working in Firefox

  1. #1
    Join Date
    Jul 2011
    Posts
    2

    Unhappy e.keyCode == 13 not working in Firefox

    I need help with this issue in Firefox. I have inherited some older code that I need to get working in Firefox. See Below

    function inputText(e) {
    if ( window.event ) {
    e = window.event;
    }

    if ( e.keyCode == 13 || e.which==13 ) {
    str = checkSpecial( f1.itext.value );
    HOL_Talk( avatar, background, voice, '', str );
    f1.itext.value = "";
    return false;
    }
    return true;
    }
    It looks like Firefox just refreshes the screen on hitting the enter key.

    Any help would be very appreciated.

  2. #2
    Join Date
    Sep 2008
    Location
    Jackson MS
    Posts
    373
    I have not had a problem with the following code in Firefox:
    Code:
    <input type="text" onchange="calculate()" size="5" name="hour2" onkeypress="var e=window.event; if(e && e.keyCode===13){this.onchange();}"/>
    but I just noticed there are three equal signs, but in a brief test two worked as well.

    The page is VCR.htm. If you check it out entering 500 tab 950 Enter works on IE9, FF5, and Crome.

  3. #3
    Join Date
    Jul 2011
    Posts
    12
    What version of FF are you using?

  4. #4
    Join Date
    Sep 2008
    Location
    Jackson MS
    Posts
    373
    Ff 5.0

  5. #5
    Join Date
    Jul 2011
    Posts
    2

    Talking My bad on this one

    I was finally able to capture the error and found that Firefox (for some reason) does not recognize my form -->f1. I took the original coded form and put it in a div and for some reason it's not able to recognize it. This is the error message from Firebug, "f1 is not defined
    str = checkSpecial( f1.itext.value );"

    Anyway, thank for your time and effort I really appreciate it.

  6. #6
    Join Date
    Jul 2011
    Posts
    12
    Good you have sorted it out!!

    Bala.
    http://www.balazblogspot.blogspot.com/

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles