案例:HTML DOM案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript">
4
function confirmInput()
5
{
6
fname=document.forms[0].fname.value
7
alert("您好 " + fname + "!您会被重定向到 www.w3xue.com")
8
}
9
</script>
10
</head>
11
12
<body>
13
<form onsubmit="confirmInput()" action="//www.w3xue.com/">
14
请输入您的名字:<input id="fname" type="text" size="20">
15
<input type="submit">
16
</form>
17
</body>
18
19
</html>