<HTML>
<script>
function divcenter(){
document.all.mxh.style.left=(Math.round((document.body.scrollWidth-200)/2)).toString()+"px"
}
</script>
<body onload="divcenter()" onresize=divcenter()>
<table width=100%>
<tr>
<td>test
</td>
</tr>
</table>
<div id=mxh style="position:absolute;left:200px;top:30px;width:200px;height:200px;background-color:#0099FF;border:2px">测试文字,永远居中</div>
</HTML>