案例:html/html5 案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<script>
5
function checkForm()
6
{
7
alert("表单已提交!");
8
}
9
</script>
10
</head>
11
<body>
12
13
<form action="/example/demo_form.aspx" onsubmit="checkForm()">
14
姓:<input type="text" name="lname"><br>
15
名:<input type="text" name="fname"><br>
16
<input type="submit" value="提交">
17
18
<p>函数 checkForm() 在提交按钮被点击时触发。此函数向用户显示一段消息。</p>
19
20
</body>
21
</html>
22