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>