<!DOCTYPE html>
<html>
<head>
<script>
function checkForm()
{
alert("表单已提交!");
}
</script>
</head>
<body>
<form action="/example/demo_form.aspx" onsubmit="checkForm()">
姓:<input type="text" name="lname"><br>
名:<input type="text" name="fname"><br>
<input type="submit" value="提交">
<p>函数 checkForm() 在提交按钮被点击时触发。此函数向用户显示一段消息。</p>
</body>
</html>