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="點擊" οnclick="alert('helloworld1')">
</body>
</html>
hello.js文件
alert("hello world3");
運行結果