Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q253 How can I control a Layer in Netscape 4 so that it is always positioned in the same location on the screen regardless of where in the document the user is currently located?

irt.org | Knowledge Base | DHTML | Q253 [ previous next ]

Q253 How can I control a Layer in Netscape 4 so that it is always positioned in the same location on the screen regardless of where in the document the user is currently located?

The following ensures that the layer is always positioned 10 pixels in and 10 pixels down from the top left hand corner of the browsers document window:

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript"><!--
function pageOffset() {
    document.layers['layerName'].pageX = window.pageXOffset + 10;
    document.layers['layerName'].pageY = window.pageYOffset + 10;
    setTimeout('pageOffset()',100);
}
//--></SCRIPT>
</HEAD>

<BODY onLoad="pageOffset()">

<LAYER NAME="layerName"  LEFT="10" TOP="10">Some content in here</LAYER>

</BODY>
</HTML>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 6th July 2009. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2009 irt.org, All Rights Reserved.