<script>
function ff(event) {
var e = window.event||event;//Event对象:发生当前事件的状态
// var src = e.srcElement||e.target;//获得事件中的value值
var c = e.keycode||e.charCode;//获得键盘输入的值的编码
// alert(e);
// alert(src.value);
alert(c);}
/**
var e;
if(window.event){
e = windows.event;
}else{
e = event;
}
*/
</script>
<body onkeypress="ff(event)">
<input type="button" value="测试" onclick="ff(event)"></body>
时间: 2024-12-10 21:39:26