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 to the CF scene
    Join Date
    Jul 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Floating or static layers in IE4 error

    Im getting an error message in the IE4 browser for a floating or static layer script on every page. Once OK is clicked the code does work. Please help. Thanks in advance

    <script language = "javascript">
    <!--

    var ns6 = (document.getElementById && !document.all) ? 1 : 0
    var ie = document.all ? 1 : 0
    var ns = document.layers ? 1 : 0


    var master = new Object("element")
    master.curLeft = -120; master.curTop = 10;
    master.gapLeft = 0; master.gapTop = 0;
    master.timer = null;

    function moveAlong(layerName, paceLeft, paceTop, fromLeft, fromTop){
    clearTimeout(eval(layerName).timer)

    if(eval(layerName).curLeft != fromLeft){
    if((Math.max(eval(layerName).curLeft, fromLeft) - Math.min(eval(layerName).curLeft, fromLeft)) < paceLeft){eval(layerName).curLeft = fromLeft}
    else if(eval(layerName).curLeft < fromLeft){eval(layerName).curLeft = eval(layerName).curLeft + paceLeft}
    else if(eval(layerName).curLeft > fromLeft){eval(layerName).curLeft = eval(layerName).curLeft - paceLeft}

    if(ns6){document.getElementById(layerName).style.left = eval(layerName).curLeft}
    if(ie){document.all[layerName].style.left = eval(layerName).curLeft}
    if(ns){document[layerName].left = eval(layerName).curLeft}
    }

    if(eval(layerName).curTop != fromTop){
    if((Math.max(eval(layerName).curTop, fromTop) - Math.min(eval(layerName).curTop, fromTop)) < paceTop){eval(layerName).curTop = fromTop}
    else if(eval(layerName).curTop < fromTop){eval(layerName).curTop = eval(layerName).curTop + paceTop}
    else if(eval(layerName).curTop > fromTop){eval(layerName).curTop = eval(layerName).curTop - paceTop}

    if(ns6){document.getElementById(layerName).style.top = eval(layerName).curTop}
    if(ie){document.all[layerName].style.top = eval(layerName).curTop}
    if(ns){document[layerName].top = eval(layerName).curTop}
    }

    eval(layerName).timer=setTimeout('moveAlong("'+layerName+'",'+paceLeft+','+paceTop+','+fromLeft+','+ fromTop+')',30)
    }

    function setPace(layerName, fromLeft, fromTop, motionSpeed){
    eval(layerName).gapLeft = (Math.max(eval(layerName).curLeft, fromLeft) - Math.min(eval(layerName).curLeft, fromLeft))/motionSpeed
    eval(layerName).gapTop = (Math.max(eval(layerName).curTop, fromTop) - Math.min(eval(layerName).curTop, fromTop))/motionSpeed

    moveAlong(layerName, eval(layerName).gapLeft, eval(layerName).gapTop, fromLeft, fromTop)
    }


    var expandState = 0

    function expand(){
    if(expandState == 0){
    setPace("master", 0, 10, 10);
    if(ie){document.menutop.src = "/i/bl/stories/6958380/menubar.gif"}; expandState = 1;}
    else{setPace("master", -120, 10, 10);
    if(ie){document.menutop.src = "/i/bl/stories/6958380/menubar.gif"}; expandState = 0;}
    }

    function FixY(){
    if(ns6){document.getElementById("master").style.top = window.pageYOffset+10}
    if(ie){document.all.master.style.top = document.body.scrollTop+10}
    if(ns){document.master.top = window.pageYOffset+10}
    }

    setInterval("FixY()",100);

    //-->
    </script>

  • #2
    New Coder
    Join Date
    Jul 2002
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts
    When I tried your script I got the following error message.

    Unterminated String Constant

    If this is the error you get change the following line


    eval(layerName).timer=setTimeout('moveAlong("'+layerName+'" ,'+paceLeft+','+paceTop+','+fromLeft+','+fromTop+'
    )',30)


    for this line

    eval(layerName).timer=setTimeout("moveAlong('+layerName+' ,'+paceLeft+','+paceTop+','+fromLeft+','+fromTop+')",30)

  • #3
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I tried your script, unfortunately it didnt work I still got the unterminated string error

  • #4
    New Coder
    Join Date
    Jul 2002
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts
    At which line number?


  •  

    Posting Permissions

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