<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title> new document </title>
<meta name="generator" content="editplus">
<meta name="author" content="">
<meta name="keywords" content="">
<meta name="description" content="">
<script>

/*******JS获取标签元素*******/
//通过ID获取标签元素 (所有浏览器都支持)
var a=document.getElementById('h1');

//通过class获取标签元素,得到的是包含对象的数组 (IE8+ 支持)
var b=document.getElementsByClassName('h1');

//通过标签名 获取标签元素 ,得到的是包含对象的数组 (所有浏览器都支持)
var c=document.getElementsByTagName('');

//通过name属性 获取标签元素,得到的是包含对象的数组 (所有浏览器都支持)
var d=document.getElementsByName('');

//通过css选择器 获取标签元素 (chrome浏览器是这种形式)
var e=document.querySelector('#h1');

//通过css选择器 获取标签元素,得到的是包含对象的数组 (IE7+支持)
var f=document.querySelectorAll('.h1');

</script>
</head>

<body>
<h1 id="h1" class="h1">DOM能干什么</h1>
<a href="#" class="h1">链接</a>
</body>
</html>