js与html的结合方式

1.使用标签<script>,直接在此标签内写入js的代码

    <script>
        alert("良言");
    </script>

2. 引入外部的js文件

<html>
   <head>
    <title>html示例</title>
   </head>
   <body>
		<script  type="text/javascript" src="1.js">
		</script>
   </body>
</html>

猜你喜欢

转载自blog.csdn.net/ll123c/article/details/88803544
今日推荐