初识前端-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>
<script src="./index.js"></script>
<script>
alert('我是里面的代码')
</script>
<!-- <style>
div {
width: 200px;
height: 200px;
background-color: yellow;
}
</style> -->
</head>
<body>
<div></div>
<!-- 可以在标签里面的属性中去写 -->
<!-- <button onclick="alert('我是弹窗')">按钮</button> -->


<!-- 在script标签之间写js代码 -->
<!-- <script>
alert("我是弹窗")
</script> -->

 

</body>

</html>

posted @ 2023-08-15 23:35  进击的程序员3321  阅读(9)  评论(0)    收藏  举报