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

Q255 How can I combine the previous scripts so that a layer in either Netscape 4 or Explorer 4 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 | Q255 [ previous next ]

<html>
<head>
<script language="JavaScript"><!--
function pageOffset() {
    if (document.layers) {
        document.layers['layerName'].pageX = window.pageXOffset + 10;
        document.layers['layerName'].pageY = window.pageYOffset + 10;
    }
    else if (document.all) {
        document.all['layerName'].style.posLeft = document.body.scrollLeft + 10;
        document.all['layerName'].style.posTop = document.body.scrollTop + 10;
    }
    setTimeout('pageOffset()',100);
}
//--></script>
</head>

<body onLoad="pageOffset()">

<div id="layerName" style="position: relative" left="10" top="10">Watermark</div>

David Faulder writes:

With Netscape Navigator 4.7 under W98 this works, but if the <div> contains anchor tags the image of them behaves (i.e still relative to screen), but the actual link stays relative to the page.

Feedback on 'Q255 How can I combine the previous scripts so that a layer in either Netscape 4 or Explorer 4 is always positioned in the same location on the screen regardless of where in the document the user is currently located?'

©2018 Martin Webb