林中誠 動態網頁設計 20121122 作業 林中誠 動態網頁設計 20121122 作業

<html>
<head>
<script type='text/javascript'>
function showTd(){
   var nodes = document.getElementsByTagName("td");
   for(var i = 0; i < nodes.length; i++) {
      var node = nodes[i];
      alert(node.childNodes[0].nodeValue);
    }
}
function showTitle(){
   document.getElementById("myTitle").innerHTML ="<h2>您真內行!</h2><h2>您真內行!</h2><h2>您真內行!</h2>";
}
</script>
</head>
<body>
<input value="showTitle" onclick="showTitle();" type="button"><br>
<input value="showTDValues" onclick="showTd();" type="button"><br>

 

<div id="myTitle"></div>
<table Border=3>
  <tbody>
    <tr>
      <td>EmpID</td>
      <td>UserID</td>
      <td>UserName</td>
    </tr>
    <tr>
      <td>E0001</td>
      <td>Polin</td>
      <td>我</td>
    </tr>   
  </tbody>
</table>
</body>
</html>

 


 

網頁測試 網頁測試


EmpID UserID UserName
E0001 Polin