Anchor.y
JavaScript 1.2+ Nav4+ Syntax
document.anchors[num].y
Description
The y property contains the y-coordinate of the anchor, in pixels, from the top edge of the document to the anchor.
Example
Listing 7.5 creates a single anchor out of a header at the top of the document. The y property is used to display the vertical position of the Anchor object on the bottom of the page.
Listing 7.5 Accessing the y Property of the Anchor Object
<html> <center><a name="B"><h4>Banana</h4></a></center> A long, yellow, curved fruit with a soft core.<hr> <script language="JavaScript"> <!-- Hide //Display the y property of the anchor document.write("The y property is equal to ",document.anchors[0].y); // ---End Hide> </script> </html> |
Get Pure JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.