如果是获取的话,你可以尝试如下,不过设置left,应该不存在兼容问题
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
.box{width:500px;height:100px;background:#6FF;position:absolute;left:30px;}</style>
<script>
window.onload=function()
{
var oBox=document.getElementById('box');
alert(getStyle(oBox,'left'));
}
function getStyle(obj,attr)
{
if(obj.currentStyle)
return parseFloat(obj.currentStyle[attr])||0;
return parseFloat(getComputedStyle(obj,0)[attr])||0;
}
</script>
</head><body>
<div class="box" id="box">
</div>
</body>
</html>