<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>

Top, right, left, and bottom in CSS must be used in combination with position, and the parent class must also have the position attribute.
Have you set absolute for p