案例:JavaScript案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html> 
2
<head> 
3
<script type="text/javascript"> 
4
function myfunction(txt) 
5
{ 
6
alert(txt) 
7
} 
8
</script> 
9
</head> 
10
11
<body> 
12
<form> 
13
<input type="button" 
14
onclick="myfunction('早安!')" 
15
value="在早晨"> 
16
17
<input type="button" 
18
onclick="myfunction('晚安!')" 
19
value="在夜晚"> 
20
</form> 
21
22
<p>通过点击这个按钮,可以调用一个函数。该函数会输出传递给它的参数。</p>
23
24
</body> 
25
</html>
26