JS的捕捉回车键
回车键的键值:13
Esc的键值:27
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<input type="text" id="username"/>
<script type="text/javascript"">
window.onload=function(){
document.getElementById("username").onkeydown=function(event){
if(event.keyCode===13){
alert('正在进行验证...')
}
}
}
</script>
</body>
</html>

浙公网安备 33010602011771号