For some reason, you can't get top/left/width/height from the style of an object if those properties were set via a class.
You *can* get them if the properties were set via style= direction in the tag.
I'm sure there's a reason for this, buried in the docs somewhere, but... That's how it works.
Simple HTML page as demo:
Code:
<html>
<head>
<style>
.box { position: absolute; top: 50px; left: 50px; width: 200px; height: 220px;
border: solid red 2px; background-color: pink;
padding: 30px;
}
</style>
<script>
function show( obj )
{
alert( "top: " + obj.style.top
+ "\nleft: " + obj.style.left
+ "\nwidth: " + obj.style.width
+ "\nheight: " + obj.style.height );
}
</script>
</head>
<body>
<div class=box onclick="show(this);"> box 1 </div>
<div class=box style="left: 400px; height: 130px;" onclick="show(this);"> box 2 </div>
<div class=box style="top: 360px; width: 180px;" onclick="show(this);"> box 3 </div>
</body>
</html>