DOM
通过DOM JavaScript 可以访问HTML文档的所有元素
DOM三种访问方式(选择器)
根据id选择:document.getElementById("c1");
根据class选择:document.getElementsByClassName("c1"); a[0].style.color="red";
根据标签选择:document.getElementsByTagName("p");
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<p class="p001">1</p>
<p class="p001">2</p>
<p class="p001">3</p>
<script>
var myP001=document.getElementsByTagName("p");
myP001[0].style.color="red";
</script>
</body>
</html>