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

I have onKeypress Event in Text Box This Works in FireFox, does not in IEevent is passed as undefined i

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742344845a4426341.html

相关推荐

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

    I have onKeypress Event in Text Box This Works in FireFox, does not in IEevent is passed as undefined i

    4小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信