JavaScript中的事件键码问题 [英] event keycode issue in javascript
本文介绍了JavaScript中的事件键码问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< textarea name ="msg" cols = 50önKeydown="Javascript:if(event.keyCode == 13){loadXMLDoc(); rs();}"
在mozillafirefox中不起作用
但使用chrome和IE
<textarea name="msg" cols=50 önKeydown="Javascript: if (event.keyCode==13) {loadXMLDoc();rs();}"
is not working in mozillafirefox
but working in chrome and IE
推荐答案
这是一个已知问题,并且多次讨论 [ window.event.keycode 13韩元"无法在Firefox中工作 [^ ]
另一个有用的链接: http://www.ryancooper.com/resources/keycode.asp [ ^ ]
It is a known issue and multiple discussions[^] can be found on internet.
FF doesn''t use window.event for keypress, but expects the event to be passed as a parameter to the function handling it
Look ''Fang'' answer here for similar discussion on how to handle it: window.event.keycode 13 won''t work in Firefox[^]
Another link that will help: http://www.ryancooper.com/resources/keycode.asp[^]
这篇关于JavaScript中的事件键码问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文