DHTML Lab - DHTML Diner - Element Page Coordinates, Part 3 | 3
Determining Element Page Coordinates, Part 3
|
Behind the scenes, the code looks something like this:
BlueSquareReference.style.left = DL_GetElementLeft(RedSquareReference) + "px"; BlueSquareReference.style.top = DL_GetElementTop(RedSquareReference) + "px";
All of the examples in this article follow the same guidelines.
Now, position the blue square by clicking on the large button.
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0> <TR> <TD WIDTH=100> </TD> <TD><IMG ID="redbox" SRC="redbox.gif" WIDTH="200" HEIGHT="200"></TD> </TR> </TABLE> |
Result
All versions of NS6+ and Mozilla positioned the square correctly using our functions. But only because we had specified a value of 0 for the table's BORDER attribute. |
If we specify a BORDER value other than 0, the results would be different.
Produced by Peter Belesis and
All Rights Reserved. Legal Notices.Created: Oct 16, 2002
Revised: Oct 16, 2002
URL: https://www.webreference.com/dhtml/diner/realpos3/3.html