编辑下面的代码:【加编码】
<html> <head> <script> function checkForm() { alert("提交表单"); } </script> </head> <body> <form action="demo_form.php" onsubmit="checkForm()"> 第一个名字: <input type="text" name="fname"><br> 最后一个名字: <input type="text" name="lname"><br> <input type="submit" value="Submit"> <p>checkForm() 函数在提交按钮被点击时触发。该函数会弹出消息。</p> </form></body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂