0

我知道我可以做类似的事情

function runScript(e) {
    if (e.keyCode == 13) {
        // some code
    }
}

但我想知道是否有其他方法。谢谢!

4

1 回答 1

0

If you want something more readable can use:

function runScript(e) {
  if(String.fromCharCode(e.keyCode) == "a") {
     //Some code
  }
}
于 2013-10-03T12:07:39.553 回答