javaScript的实现

HTML 的 <script> 标签用于把 JavaScript 插入 HTML 页面当中。

1.在HTML页面直接书写<script></script>标签

<html>

<body>

<script type="text/javascript">

document.write("Hello World!");

</script>

</body>

</html>

<script type="text/javascript"> 和 </script> 就可以告诉浏览器 JavaScript 从何处开始,到何处结束。

上面的代码会在 HTML 页面中产生这样的输出:

Hello World! 

2.在web项目新建js文件,在js文件中书写JavaScript,把路径放在HTML页面中

<html>

<head>

<script src="xxx.js">....</script>

</head>

<body>

</body>

</html>
原文地址:https://www.cnblogs.com/JSWBK/p/5602775.html