JS只能取出Table节点的属性, 而不能取出 TR 或TD 节点的属性 , 很奇怪.为何?
<html>
<head>
<title>Untitled Page</title>
<script type="text/javascript" language="javascript">
function window_onload()
{
alert( document.getElementById("a").getAttribute("datafld") ) ;
alert( document.getElementById("b").getAttribute("datafld") ) ;
alert( document.getElementById("c").getAttribute("datafld") ) ;
}
</script>
</head>
<body onload="return window_onload()">
<form id="form1">
<div id="a" datafld="aeff">
<table id="msgTable" style=" 100%">
<tr id="b" datafld="aeff">
<td id="c" title="优先级" datafld="aeff">
ff
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
<head>
<title>Untitled Page</title>
<script type="text/javascript" language="javascript">
function window_onload()
{
alert( document.getElementById("a").getAttribute("datafld") ) ;
alert( document.getElementById("b").getAttribute("datafld") ) ;
alert( document.getElementById("c").getAttribute("datafld") ) ;
}
</script>
</head>
<body onload="return window_onload()">
<form id="form1">
<div id="a" datafld="aeff">
<table id="msgTable" style=" 100%">
<tr id="b" datafld="aeff">
<td id="c" title="优先级" datafld="aeff">
ff
</td>
</tr>
</table>
</div>
</form>
</body>
</html>