document.write("<h1>外部js文件</h1>");
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<!-- 外部式 可以在任意位置添加 位置不同
影响js文件中内容出现的位置不同 -->
<script src="001.1.js"></script>
</head>
<body>
<!-- 内嵌式 少用 -->
<p onclick="alert('hello everyone!')">第一个段落</p>
<p onclick="msg()">第二个段落</p>
<!-- 内部式 -->
<script>
document.write("<h1>内部js文件</h1>");
function msg(){
alert('hello everyone!');
}
document.write("<br>");//换行
var x=5;//定义变量
document.write(typeof(x));//查看变量类型
</script>
</body>
</html>