<!DOCTYPE html>
<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>
</body>
</html>