老师啊,我这段代码为什么keyCode在哪里都显示0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <!DOCTYPE html> < html > < head > < title >事件类型</ title > < meta charset = "utf-8" > </ head > < body > < input type = "text" name = "" id = "text" > < script type = "text/javascript" > var text = document.getElementById("text"); text.onkeydown=function(){ console.log("keycode:"+event.keyCode); console.log("charcode:"+event.charCode) } </ script > </ body > </ html > |
源自:JS事件
3-5 事件类型(三)
4
收起
正在回答 回答被采纳积分+1
2回答
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧