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

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?

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

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?

<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?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


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