<style type="text/css">
.a{
width: 50px;
height: 50px;
background: red;
}
table{
border-collapse: collapse;
position: relative;
}
td{
width: 50px;
height: 50px;
border:1px solid;
}
</style>
</head>
<body>
<table>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td><p class="a" style="left:5![图片描述][1]0px; top: 50px;"></p></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
<script type="text/javascript">
var p = document.getElementsByTagName('p')[0];
p.style.left = '20px';
document.write(p.style.left);
</script>

css中的top、right、left、bottom都要结合position使用的,并且父类中有也要有position属性。
你给p设置absolute了嘛