[TOC]
编写位置
1、网页html标签中
多个位置都可以编写
<html>
<head>
<script>
1.这里写javaScript
</script>
</head>
<body>
<input type="button" value="按钮" onclick="2.可以在部分标签的事件内写javaScript">
<script>
3.这里写javaScript
</script>
</body>
</html>
2、外部文件中(常用推荐)
网页外创建一个xxx.js的文件,在里面写。外部脚本不能包含