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>