【发布时间】:2011-07-29 07:39:21
【问题描述】:
FireFox 的 jQuery 按键事件为事件对象提供加密的 keyCode 属性
String.fromCharCode(e.keyCode) 转换后,但在 Chrome 中完美运行。
以下是javascript代码:
<!-- #booter and #text are ids of html element textarea -->
<script type="text/javascript">
$(function(){
$('#booter').keypress(function(e){
var input = $(this).val() + String.fromCharCode(e.keyCode);
$('#text').focus().val(input);
return false;
});
});
</script>
【问题讨论】:
标签: javascript jquery events keypress keycode