Code at the bottom…
As far as I understood it, offsetTop is the distance in pixels from the top of the web browser window to to beginning of an element. But in the case below, it doesn’t work.
Howcome?
// Michelle
<script>
function testa(num) {
var tableId = “t”+num;
document.getElementById(‘MenuLayer’).style.top = document.getElementById(tableId).offsetTop;
}
</script>
</head>
<body>
<a href=”#” onClick=”testa(3)”>test</a><br>
<table width=”300″ cellspacing=”0″ cellpadding=”0″ border=”1″>
<tr>
<td>dsfg</td>
</tr>
<tr>
<td>dsfg</td>
</tr>
<tr>
<td id=t3>dsg</td>
</tr>
</table>
<div id=”MenuLayer” style=”position:absolute; background-color:gray; layer-background-color:gray; visibility:visible;”>
bla bla bla
</div>