input type text and onKeyDown not working under IE

Posted by dygi on Stack Overflow See other posts from Stack Overflow or by dygi
Published on 2010-04-05T10:26:15Z Indexed on 2010/04/05 10:33 UTC
Read the original article Hit count: 513

Hi there. I am writing a WWW application, it has to run under IE. I have the problem with the code that runs under FF, but i can't get it running under IE.

// JS code

function test()
{
    if (window.event.keyCpde == 13)
        window.location.href.ssign("myPage.php");
}

I've tried some similar ways around window.location and location.href, also document.location. I've read that IE has problems with that, so i ask for a solution.

The goal is, that page reloads after typing in some text into <input type='text' name='item_code' onKeyDown='test()'> and click enter. So the result is similar to pressing submit type button below the text input.

Within IE it reloads the same page and nothing happens. In FF it correctly works.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about javascript-events