2023-08-18T15:20:38.png

<!DOCTYPE html>
<html lang="zh">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

  <style>






  </style>

</head>
<body>
  
  



  <input type="text" id="wbk">


  <input type="text" id="ssk">





<script>

var wbk = document.getElementById("wbk");
wbk.onkeydown = function(e){
  console.log("按下了:"+e.target.value);
  
};


wbk.onkeyup = function(e){
  console.log(e.target.value);
};



//
wbk.onkeypress = function(){
  console.log("onkeypress");
};



var ssk = document.getElementById("ssk");

ssk.onkeyup = function(e){

  console.log(e.keyCode);

  if(e.keyCode === 13){
    console.log("按下了回车键");
  };

};






</script>






</body>
</html>