1第一个js

来源:互联网 发布:浙江软件水平考试 编辑:程序博客网 时间:2024/05/21 15:02

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>第一个js</title>
<script src="script.js"></script><!--引入外部js文件-->
</head>
<body>
  <p id="p1">我是第一段文字</p>
  <p id="p2">我是第二段文字</p>
 
  <script type="text/javascript">
 document.write("hello");<!--输出hello-->
 document.getElementById("p1").style.color="blue";
  </script><!--script标签可以放在head,body里也可以新建一个js文件引入-->
</body>
</html>

-----------------------------------------------------js--------------------------------------------------------------


document.write("引用JS文件!");

原创粉丝点击