<!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>
