运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
转到 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript HTML Events</h1> <h2>The onkeyup Attribute</h2> <p>An onkeyup event occurs when the a keyboard key is on its way UP:</p> <form> Enter your name: <input type="text" name="myInput" onkeyup="writeMessage()" size="20"> <input type="text" name="mySecondInput" size="20"> </form> <script> function writeMessage() { document.forms[0].mySecondInput.value = document.forms[0].myInput.value; } </script> </body> </html>