编辑下面的代码:【加编码】
<html> <body> <p>想文本域中输入信息并点击重置按钮。</p> <form onreset="myFunction()"> <input type="text" id="myInput"> <input type="reset"> </form> <script> function myFunction() { var x = document.getElementById("myInput"); alert("重置前,文本信息为: " + x.value); } </script> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂