实例首页
自学教程
IT工具箱
源代码
下载代码
上下布局
点击运行 >
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>html onsubmit 实例 - 自学教程(runoops.com)</title> <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="提交"> </form> <p> checkForm() 函数在提交按钮被点击时触发。该函数会弹出消息。</p> </body> </html>
运行结果: