Web Page with Static Navbar

The navbar of a web page can be make to remain static at the top of the page with the following code added to an HTML snippet:


<script language="JavaScript" type="text/javascript">

<!--

elem = parent.document.getElementById('nav_layer');

elem.style.backgroundImage='url(URL TO IMAGE FILE ON SERVER FOR NAVBAR BACKGROUND';

elem.style.backgroundRepeat='repeat-1';

elem.style.position='fixed';

elem.style.zIndex='100';


elem = parent.document.getElementById('body_layer');


elem.style.marginTop='150px';


// -->

</script>




The elem.style.backgroundImage  element is needed so the navbar background does not become transparent. Having the contents of the page display thru the navbar area is not very attractive and makes it difficult to see the links.



I used the same image file that I used for the browser and page background.  Contrasting background files can be used as the page design permits.



Thanks to Wyodor for the code.