编辑下面的代码:【加编码】
<html> <head> <script> function greeting() { alert("Welcome " + document.forms["frm1"]["fname"].value + "!") } </script> </head> <body> What is your name?<br> <form name="frm1" action="tryjsref_form_onsubmit.htm" onsubmit="greeting()"> <input type="text" name="fname"> <input type="submit" value="Submit"> </form> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂