<script>
function GetStyle(object,name)
{
if(object.currentStyle)
{
return object.currentStyle[name];
}
else
{
return getComputedStyle(object,false)[name];
}
}
window.onload=function()
{
var oDiv=document.getElementById(‘div1‘);
alert(GetStyle(oDiv,‘width‘));
}
</script>
时间: 2024-10-24 16:31:22