...

View Full Version : Script won't work in IE



Dave Laurie
11-02-2004, 10:32 PM
Hello there,

I have inherited a script and not really being a wizard with js, I can't tell if I am up against a browser bug or bad coding. This script works fine in mozilla, moving some content down the left side of the page, acting like a scrolling nav bar. There is no function in IE.

The script:
function slideMenu () {currentY = null;
if (window.innerHeight) {currentY=window.pageYOffset}
else if (document.body) {currentY=document.body.scrollTop}
else {return null}

var menuObjStyle = document.getElementById("leftcontent").style
menuObjStyle.top = (currentY+115)+"px";
// var tmp = parseInt(menuObjStyle.top) + parseInt((currentY-parseInt(menuObjStyle.top))/4)+120
window.status=currentY
// if (isNaN(tmp)) {menuObjStyle.top="500px"}
// else {menuObjStyle.top = tmp}
slideMenuTimerId = setTimeout("slideMenu()",900);
}
window.onload=slideMenu;

I'm hoping someone can tell me if IE uses different syntax or identifiers to catch the browser window boundaries.

Cheers,
Dave

liorean
11-02-2004, 10:59 PM
If ie6w is in standards mode, you have to access document.documentElement instead of document.body. To detect if the browser is in standards mode, read out the value of document.compatMode. It will contain the value 'BackCompat' if it is in quirks mode, and 'CSS1Compat' if it is in standards compatibility mode.

jbot
11-03-2004, 09:46 AM
If ie6w is in standards mode, you have to access document.documentElement instead of document.body. To detect if the browser is in standards mode, read out the value of document.compatMode. It will contain the value 'BackCompat' if it is in quirks mode, and 'CSS1Compat' if it is in standards compatibility mode.

thanks, liorean, i didn't know that. cheers :thumbsup:

Dave Laurie
11-04-2004, 08:34 PM
Thanks Liorean! That did the trick.

You rule. :cool:

Dave



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum