<!DOCTYPE HTML>
<html>
<body>
<div style="position:fixed; top:100px;" id="d">hello</div>
<script>
document.write(document.getElementById("d").offsetTop);
</script>
</body>
</html>