Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Event is Undefined in IE works in Firefox

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); }
like image 339
Praveen Avatar asked Sep 22 '10 23:09

Praveen


1 Answers

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);
};
like image 158
Marcel Korpel Avatar answered Nov 05 '22 05:11

Marcel Korpel