1. The first writing format of js: write directly inside the element
<html>
<head>
<title >JavaScript</title>
</head>
<body>
<!-- 1、行内式的js :直接写在标签的内部-->
<input type="button" value="唐伯虎" onclick="alert('秋香姐')">
</body>
</html>
Effect: Click the Tang Bohu button and a selection box for Qiuxiang will appear
2. The second writing format of JS: embedded JS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<!-- 内嵌式的JS -->
<script>
alert("沙漠骆驼")
</script>
</head>
<body>
</body>
</html>
Effect: "Desert Camel" pops up directly in the browser
3. External JS writing method: display the content on the current page by referencing the already written js file
<script src="my.js"></script>