<html>
<head>
<script type='text/javascript'>
function showTd(){
var nodes = document.getElementsByTagName("td");
for(var i = 0; i < nodes.length; i++) {
alert(nodes[i].childNodes[0].nodeValue);
}
}
function showTitle(){
document.getElementById("myTitle").innerHTML ="<h2>網頁測試</h2><h2>網頁測試</h2><h2>網頁測試</h2>";
}
</script>
</head>
<body>
<h2><input value="showTitle" onclick="showTitle();" type="button"><br></h2>
<h2><input value="showTDValues" onclick="showTd();" type="button"><br></h2>
<div id="myTitle"></div>
<table border=2>
<tbody>
<tr>
<td>EmpID</td>
<td>UserID</td>
<td>UserName</td>
</tr>
<tr>
<td>E0001</td>
<td>Polin</td>
<td>我</td>
</tr>
</tbody>
</table>
<h2>網頁測試</h2><h2>網頁測試</h2><h2>網頁測試</h2>
</body>
</html>