Similar to CSS styles, JavaScript also has three ways to write different locations.
1, written within the line
<input type="button" value="按钮" onclick="alert('Hello World')" />
2, written in the script tag
<head>
<script>
alert('Hello World!');
</script>
</head>
3, written in an external js file, the introduction of the page
<script src="main.js"></script>
Note : references to external js file script tag can not write JavaScript code