<script language="javascript">
//coded by windy_sk 20021013 <windy_sk@126.com>
var ie = (document.getElementById && document.all);
document.onkeyup = function(e) {
if(ie) e = event;
var keycode = e.keyCode;
var realkey = String.fromCharCode(keycode);
var str = "keycode: " + keycode + " realkey: " + realkey;
document.getElementById("keyup").value = str;
}
document.onkeydown =function(e) {
if(ie) e = event;
var keycode = e.keyCode;
var realkey = String.fromCharCode(keycode);
var str = "keycode: " + keycode + " realkey: " + realkey;
document.getElementById("keydown").value = str;
}
document.onkeypress = function(e) {
if(ie) e = event;
var keycode = e.keyCode;
var realkey = String.fromCharCode(keycode);
var str = "keycode: " + keycode + " realkey: " + realkey;
document.getElementById("keypress").value = str;
}
</script>
keydown: <input id="keydown" style=" 400px"><br>
keyup: <input id="keyup" style=" 400px"><br>
keypress: <input id="keypress" style=" 400px"><br>