Please take a look at the example below.
The offsetTop off the table = 15
The offsetTop off Cell-1 = 3 (So this is the offsetTop from the top of the table)
How do I get the real offsetTop off the Cell-1 in relation to the screen.
Please don't asnwer me something like:
"real-offsetTop" = "offsetTop Cell" + "offsetTop Table" because the table is in the center of a huge page.
Second reason is that I use the same function for a onmouseover of links <a>. And in these links I get the real offsetTop OK.
So I need to get the offsetTop off teh Cell at once.
Oh year, I need a crossbrowser solution.
Question 2) Is offsetTop crossbrowser anyway? (of course not NN4, which I don't support anymore)
<html>
<head>
<script language="javascript">
function showOffsetTops(thiselem)
{
OSTtab = document.getElementById('tabH').offsetTop;
alert("tabel.offsetTop = " + OSTtab + "\n thiselem.offsetTop = " + thiselem.offsetTop)
}
</script>
</head>
<body>
<table id="tabH" border=1 width="140px">
<tr>
<td id=celH1 onmouseover="showOffsetTops(this)">Cell 1</td>
</tr>
<tr>
<td id=celH2 onmouseover="showOffsetTops(this)">Cell 2</td>
</tr>
<tr>
<td id=celH3 onmouseover="showOffsetTops(this)">Cell 3</td>
</tr>
</table>
</body>
</html>
Erik <-- My sport: Boomerang throwing !!
!! Many Happy Returns !! -->
The offsetTop off the table = 15
The offsetTop off Cell-1 = 3 (So this is the offsetTop from the top of the table)
How do I get the real offsetTop off the Cell-1 in relation to the screen.
Please don't asnwer me something like:
"real-offsetTop" = "offsetTop Cell" + "offsetTop Table" because the table is in the center of a huge page.
Second reason is that I use the same function for a onmouseover of links <a>. And in these links I get the real offsetTop OK.
So I need to get the offsetTop off teh Cell at once.
Oh year, I need a crossbrowser solution.
Question 2) Is offsetTop crossbrowser anyway? (of course not NN4, which I don't support anymore)
<html>
<head>
<script language="javascript">
function showOffsetTops(thiselem)
{
OSTtab = document.getElementById('tabH').offsetTop;
alert("tabel.offsetTop = " + OSTtab + "\n thiselem.offsetTop = " + thiselem.offsetTop)
}
</script>
</head>
<body>
<table id="tabH" border=1 width="140px">
<tr>
<td id=celH1 onmouseover="showOffsetTops(this)">Cell 1</td>
</tr>
<tr>
<td id=celH2 onmouseover="showOffsetTops(this)">Cell 2</td>
</tr>
<tr>
<td id=celH3 onmouseover="showOffsetTops(this)">Cell 3</td>
</tr>
</table>
</body>
</html>
Erik <-- My sport: Boomerang throwing !!
!! Many Happy Returns !! -->