Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Oct 2004
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Script won't work in IE

    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

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    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.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #3
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by liorean
    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
    *keep it simple (TM)

  • #4
    New Coder
    Join Date
    Oct 2004
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Liorean! That did the trick.

    You rule.

    Dave


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •