日期:2014-05-17  浏览次数:20818 次

这段代码如何使之在firefox里正常运行!!!在线求解
这是OnLineService.js的代码

JScript code
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(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(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)
}
function FixY(){
    if(document.body.scrollTop>0){
        if(ie){sidemenu.style.top = document.body.scrollTop+90}
    }else{
        if(ie){sidemenu.style.top = document.documentElement.scrollTop+90}
    }    
    if(ns){sidemenu.top = window.pageYOffset+90}
}





页面上调用JS的代码
JScript code

<script language="JavaScript" src="js/OnLineService.js" type="text/JavaScript"></script>

<script language="javascript">

                                    window.onerror = function(){}
                                    var expandState = 0;
                                    function expand(){
                                    if(expandState == 0){setPace('master', 0, 10, 10); if(ie){document.menutop.src = '../Themes/Skin_Default/Images/menui.jpg'}; expandState = 1;}


                                    else{setPace('master', -196, 10, 10); if(ie){document.menutop.src='../Themes/Skin_Default/Images/menuo.jpg'}; expandState = 0;}
                                    }
                                    document.write("<style type=text/css>#master {LEFT: -196px; POSITION: absolute; TOP: 90px; VISIBILITY: visible; Z-INDEX: 999}</style>")
                                    document.write("<table id=master width='218' border='0' cellspacing='0' cellpadding='0'><tr><td></td><td rowspan='2' valign='top'><img id=menu onMouseOver=javascript:expand() border=0 height=100 name=menutop src=../Themes/Skin_Default/Images/menuo.jpg width=30></td></tr>");
                                    document.write("<tr><td valign='top'><table width='101%' border='0' cellpadding='0'><tr><td height='400' valign='top'><table width=100% height='100%' b