日期:2014-05-16 浏览次数:20384 次
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
function getNodeLevel()
{
var tableNode = document.getElementById("ta");
// alert(tableNode.nodeName);
var chile = tableNode.childNodes;
alert(chile[0].nodeName);
}
</script>
</head>
<body>
<input type="button" value="通过节点关系获取节点" onclick="getNodeLevel()">
<div>div区域</div>
<table id="ta">
<tbody>
<tr>
<td>哈哈</td>
<td>啦啦</td>
</tr>
</tbody>
</table>
<dl>
<dt>上层项目</dt>
<dd>下层项目</dd>
</dl>
</body>
</html>