Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道我可以做类似的事情
function runScript(e) { if (e.keyCode == 13) { // some code } }
但我想知道是否有其他方法。谢谢!
If you want something more readable can use:
function runScript(e) { if(String.fromCharCode(e.keyCode) == "a") { //Some code } }