0

有谁知道为什么该onkeydown()事件不适用于IEdeletebackspace键入 IE?它适用于数字和字符键。

4

1 回答 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 回答