JavaScript嵌入页面的3种方式
1、行间事件(主要用于事件)
2、页面script标签嵌入
3、外部引入
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<!--嵌入js方式3 外联-->
<script type="text/javascript" src="js/hello.js"></script>
<!--嵌入js方式2 内嵌-->
<script type="text/javascript">
alert("helloworld2");
</script>
</head>
<body>
<!--嵌入js方式1 行间事件-->
<input type="button" name="" value="点击" onclick="alert('helloworld1')">
</body>
</html>
hello.js文件
alert("hello world3");
运行结果