onkeyup - 当用户释放按键时
- <!DOCTYPE html>
- <html>
- <head>
- <script>
- function writeMessage() {
- document.forms[0].mySecondInput.value = document.forms[0].myInput.value;
- }
- </script>
- </head>
- <body>
- <p>当键盘按键正在向上移动时,会发生 onkeyup 事件。</p>
- <form>
- 请输入您的姓名:
- <input type="text" name="myInput" onkeyup="writeMessage()" size="20">
- <input type="text" name="mySecondInput" size="20">
- </form>
- </body>
- </html>