Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q254 How can I control a layer in Explorer 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?

You are here: irt.org | FAQ | DHTML | Q254 [ previous next ]

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.all['layerName'].style.posLeft = document.body.scrollLeft + 10;
    document.all['layerName'].style.posTop = document.body.scrollTop + 10;
    setTimeout('pageOffset()',100);
}
//-->
</head>

<body onLoad="pageOffset()">

<div id="layerName" left="10" top="10">Some content in here</div>

</body>
</html>

Feedback on 'Q254 How can I control a layer in Explorer 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?'

©2018 Martin Webb