好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

从有ID的对象根据层次关系获得无ID的对象

从有ID的对象根据层次关系获得无ID的对象

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<div id="Test">
<button>Add One</button>
<button>Show/Hide Heading</button>
<button onclick="show()">Show/Hide Root</button>
</div>
<script language="javascript">
function show()
{
  var obj = document.getElementById("Test");
  alert(obj.firstChild.innerHTML);
  alert(obj.childNodes[1].innerHTML);
  alert(obj.childNodes[2].innerHTML); 
}
</script>
</body>
</html>

查看更多关于从有ID的对象根据层次关系获得无ID的对象的详细内容...

  阅读:45次