onkeyup - 当用户释放按键时

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script>
  5. function writeMessage() {
  6. document.forms[0].mySecondInput.value = document.forms[0].myInput.value;
  7. }
  8. </script>
  9. </head>
  10. <body>
  11.  
  12. <p>当键盘按键正在向上移动时,会发生 onkeyup 事件。</p>
  13.  
  14. <form>
  15. 请输入您的姓名:
  16. <input type="text" name="myInput" onkeyup="writeMessage()" size="20">
  17. <input type="text" name="mySecondInput" size="20">
  18. </form>
  19.  
  20. </body>
  21. </html>