小小的demo,用js捕捉鍵盤(pán)盤(pán)上按下了那個(gè)鍵,然后展示出對(duì)應(yīng)的code值
<!DOCTYPE html><html><head><script>function showKeyCode(event){document.getElementById("result").value= event.keyCode;} </script></head> <body onkeyup="showKeyCode(event)"><p>按下鍵盤(pán)上的鍵,文本框中會(huì)顯示對(duì)應(yīng)的code</p><input type="text" id="result" value="1" /></body> </html>以上所述就是本文的全部?jī)?nèi)容了,希望大家能夠喜歡。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注