469,287 Members | 2,785 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,287 developers. It's quick & easy.

fixed layer and IF code for IE

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;heig ht: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.documentEle ment: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>

------------------------------------------
(Please excuse the 'burp' when replying)
Jul 20 '05 #1
1 3318
Jaz
Jaz <ha*****@beerburp.com> forgot to take the pills and typed:

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)
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Roger Leigh | last post: by
1 post views Thread by PAD | last post: by
41 posts views Thread by Richard | last post: by
1 post views Thread by Roderik Emmerink | last post: by
2 posts views Thread by headware | last post: by
9 posts views Thread by SAL | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.