开发者

Modify event variable in JavaScript

Is there a way to modify the event variable (IE: window.event, others: e) in JavaScript? I know you can easily clone it, using a quick loop copy. However, the bro开发者_开发问答wser won't let you do that for methods like e.preventDefault() and such. So, I'm looking for another way to do it.

(Yes, I know it probably isn't a good idea. But I want to do it anyways.)


Well (keeping in the back of your mind RobG's comment), you can add methods to the prototype of Event, and you can overwrite native methods in the Event.prototype.

Like in this jsfiddle. Is that what you meant?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜