楼上已经说了一部分了,剩下的就是在html中添加js脚本<script src='location'></script>
<script src='location'></script>
把
<script>里面的内容</script>
把里面的内容提出来,写到xxx.js里面。然后
<script src="xxx.jx"></script>