有谁知道为什么该onkeydown()事件不适用于IEdelete并backspace键入 IE?它适用于数字和字符键。
2578 次
1 回答
0
你确定吗?.. 以下在 IE 上看到 delete 和 backspace 很好:
<html>
<head>
<script type="text/javascript">
function keypress(e)
{
var keycode;
if (window.event) // IE
{
keycode = e.keyCode;
}
else if (e.which) // Netscape/FF/Op
{
keycode = e.which;
}
alert(keycode);
}
</script>
</head>
<body>
<form>
<input type="text" onkeydown="return keypress(event)" />
</form>
</body>
</html>
于 2009-03-20T04:36:27.223 回答