-
function定义函数的关键字。
-
"函数名"你为函数取的名字。
函数基本语法
function 函数名()
{
函数代码;
}
使用
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>函数调用</title>
<script>
function click() //定义函数
{
alert("调用函数了!");
}
</script>
</head>
<body>
<form>
<input type="button" value="点击我" onclick="click()" />
</form>
</body>
</html>