Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

offsetTop off table-cell

Status
Not open for further replies.

Boomerang

Programmer
Mar 30, 2001
766
NL
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=&quot;javascript&quot;>
function showOffsetTops(thiselem)
{
OSTtab = document.getElementById('tabH').offsetTop;
alert(&quot;tabel.offsetTop = &quot; + OSTtab + &quot;\n thiselem.offsetTop = &quot; + thiselem.offsetTop)
}
</script>
</head>
<body>
<table id=&quot;tabH&quot; border=1 width=&quot;140px&quot;>
<tr>
<td id=celH1 onmouseover=&quot;showOffsetTops(this)&quot;>Cell 1</td>
</tr>
<tr>
<td id=celH2 onmouseover=&quot;showOffsetTops(this)&quot;>Cell 2</td>
</tr>
<tr>
<td id=celH3 onmouseover=&quot;showOffsetTops(this)&quot;>Cell 3</td>
</tr>
</table>
</body>
</html>


Erik <-- My sport: Boomerang throwing !!
!! Many Happy Returns !! -->
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top