Event is Undefined in IE works in Firefox

2019-06-19 03:17发布

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); }

1条回答
来,给爷笑一个
2楼-- · 2019-06-19 03:32

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);
};
查看更多
登录 后发表回答