<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="Outer.js" type="text/javascript"></script>
<script type="text/javascript">
alert("Hello");
</script>
</head>
<body>
<a href="JavaScript:alert('运行JS脚本')">使用JavaScript脚本</a>
</body>
</html>
首先创建一个JS文件
/** * Created by admin on 2017/2/16. */ alert("这是外部的Hello Word")