书上说:因为<table>是在DOM层次中距<td>最近的一个具有大小的元素。
那我给tr设置大小并且定位了,为什么还是获取的还是table?
类似这个样子:
<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript">
window.onload=function(){
var t=document.getElementById('name');
alert(t.offsetParent) //为什么是TABLE
}
</script>
</head>
<body>
**<table>
<tr >
<td id="name">姓名</td>
</tr>
</table>**
</body>
</html>