簡體   English   中英

網頁上的按鍵“輸入”不適用於Chrome

[英]Key press 'enter' on web page does not work on chrome

我有處理按鍵操作進入特定按鈕事件的javascript:

if (window.event)
    key = window.event.keyCode;     //IE
else
    key = e.which;     //firefox

if (key == 13) {
//Get the button the user wants to have clicked
var btn = document.getElementById(buttonName);
if (btn != null) { //If we find the button click it
    btn.click();
    event.keyCode = 0
}

它適用於IE和Firefox,但不適用於Chrome。 有什么辦法嗎?

對chrome使用e.keyCode 據我所知,它也可以在IE和Firefox中使用

暫無
暫無

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

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