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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript isn't working in IE10

    Hello I'm using IE10 and Coldfusion 10. I have a Javascript I'm running that will goto the first key pressed on a CF list query:
    Code:
    <script>
    
    var tex='';
    var focused=false;
    
    document.onkeydown=function() {
    if (focused && event.keyCode==8) {
    tex=tex.substr(0, tex.length-1);
    document.onkeypress(1);
    return false;
    }
    }
    
    document.onkeypress=function(f) {
    if (!f) {
    var e=event.keyCode;
    switch (true) {
    case (e==9||e==13||e==38||e==40): return true; break;
    case (31<e<127): tex+=String.fromCharCode(e); break;
    default: return false;
    }
    }
    
    window.status = tex;
    var i = -1;
    while (focused.options[++i])
    if (focused.options[i].text.substr(0,tex.length).toLowerCase()==tex.toLowerCase()) break;
    focused.selectedIndex=i;
    return false;
    }
    
    function comboReset() {
    tex=''; 
    focused=false; 
    window.status=''; 
    return true;
    }
    
    //-->
    </script>
    For the life of me I can't get it to work on IE10. What might I be doing wrong?

    Thanks

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,550
    Thanks
    78
    Thanked 4,382 Times in 4,347 Posts
    I don't see why it works in any browser.

    This code is totally bogus:
    Code:
    case (31<e<127):
    It needs to be written as
    Code:
        case ( 31 < e && e < 127 ) :
    Anyway, why not use the debugger in IE10 to see where your error is?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Tags for this Thread

    Posting Permissions

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