最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Event is Undefined in IE works in Firefox - Stack Overflow

programmeradmin1浏览0评论

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);
};
发布评论

评论列表(0)

  1. 暂无评论