<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>getRellystyle</title>
</head>
<body>
<div id="box" class="box" style="width:200px; height:200px; border:1px solid #f60;">
</div>
<script type="text/javascript">
//console
var getDiv = document.getElementById("box");
function getRelStyle(object,attribute){
var style;
if(window.getComputedStyle){
style = window.getComputedStyle(object,null);
}else if(object.currentStyle){
style = object.currentStyle;
}
return style[attribute];
}
alert(getRelStyle(getDiv,"width"))
</script>
</body>
</html>
getRelStyle
最新推荐文章于 2013-04-08 17:17:04 发布