簡體   English   中英

Onkeydown() 不適用於 IE 中的刪除和退格

[英]Onkeydown() does not work for delete and backspace in IE

有誰知道為什么onkeydown()事件不適用於 IE 中的刪除退格鍵? 它適用於數字和字符鍵。

你確定嗎? .. 以下在 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> 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM