javascript 获取内联样式
<script><br />
//获取内联样式元素<br />
function getStyle( obj , attr )<br />
{<br />
if ( window.getComputedStyle ) {<br />
return getComputedStyle( obj , null )[attr];<br />
}else{<br />
return obj.currentStyle[attr];<br />
}<br />
}<br />
//获取对象<br />
function $(id){<br />
return document.getElementById(id);<br />
}<br />
var box = $('box');
<p>//打印样式<br />
alert(getStyle(box , 'background-position'));<br />
</script>