fixed layer and IF code for IE

J

Jaz

Trying to use a fixed layer for a couple of NAV buttons.

I found this code, but the IE part is commented, and I don't
understand the IF statement. It works great on Moz/Firebird and Opera
BUT not IE. Would someone please take a look at this and tell me if it
can made to work in IE? If it can, a hint on the syntax/code would be
much appreciated! PS, this would also get rid of my fixed background.

Thanks in advance
Jaz
------------------------------------------
<style type="text/css">
#fixed
{position:fixed;left:10px;top:100px;width:0px;height:0px;border:0px;background:#330000;color:#330000;}
</style>
<!--[if IE]>
<style type="text/css">
#fixed {position:absolute;}
</style>
<script type="text/javascript">
function fixIE(id) {
var elem=document.all[id]; // IE only, so document.all is safe
elem.style.position="absolute"; // "fixed" doesn't work in IE
var
root=document.documentElement?document.documentElement:document.body;
var posX=elem.offsetLeft-root.scrollLeft;
var posY=elem.offsetTop-root.scrollTop;
root.onscroll=function() {
elem.style.left = (posX + root.scrollLeft) + "px";
elem.style.top = (posY + root.scrollTop) + "px";
};
}
function initIE(){fixIE("fixed");}
</script>
<![end if] -->
<!--[if IE 6]>
<style type="text/css">
html {
overflow: hidden;
margin:0px;
padding:0px;
}
body {
overflow: auto;
margin: 0px 0px 0px 100px;
padding: 0px 8px;
height:100%;
}
</style>
<script type="text/css">
initIE = undefined;
</script>
<![end if] -->
</head>
<body onload="if (initIE) initIE()">
<div id="fixed">
<table><tr><td>
<a href="index.html"><img src="butn_home.jpg" width=100
height=40 border=0 alt=""></a>
<a href="products.html"><img src="butn_products.jpg" width=100
height=40 border=0 alt=""></a>
<a href="order.html"><img src="butn_order.jpg" width=100
height=40 border=0 alt=""></a>
<a href="contact.html"><img src="butn_contact.jpg" width=100
height=40 border=0 alt=""></a>
<a href="knownby.html"><img src="butn_knownby.jpg" width=100
height=40 border=0 alt=""></a>
</td></tr></table>
</div>
 
J

Jaz

Jaz said:
Trying to use a fixed layer for a couple of NAV buttons.

I found this code, but the IE part is commented, and I don't
understand the IF statement. It works great on Moz/Firebird and Opera
BUT not IE. Would someone please take a look at this and tell me if it

Um... nevermind... it seems to work fine by itself. I guess it's how I
built it into my own page. I'll keep trying...
(Please excuse the 'burp' when replying)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,082
Messages
2,570,588
Members
47,210
Latest member
JuliaMulli

Latest Threads

Top