admin管理员组

文章数量:1332980

I have onKeypress Event in Text Box This Works in FireFox, does not in IE

event is passed as undefined in IE

PriceInBox.onkeypress = function(event) { return moZoltarCurrent.evt_checkForInt(event); }

I have onKeypress Event in Text Box This Works in FireFox, does not in IE

event is passed as undefined in IE

PriceInBox.onkeypress = function(event) { return moZoltarCurrent.evt_checkForInt(event); }
Share Improve this question edited Sep 22, 2010 at 23:55 Marcel Korpel 21.8k6 gold badges62 silver badges80 bronze badges asked Sep 22, 2010 at 23:50 PraveenPraveen 591 silver badge2 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

You need to normalize the Event interface, as IE doesn't pass it along as a parameter, but uses a global variable:

PriceInBox.onkeypress = function(event) {
    event = event || window.event;
    return moZoltarCurrent.evt_checkForInt(event);
};

本文标签: javascriptEvent is Undefined in IE works in FirefoxStack Overflow