主题:  [求助]用两个事件控制同一页面上的不同层问题

FATHER FRTFRBABY

职务:普通成员
等级:1
金币:1.0
发贴:178
#12006/12/3 15:35:07
=====
<SCRIPT FOR=window EVENT=onload LANGUAGE="JScript">
   initAd1();//载入页面后,调用函数initAd1()
   </SCRIPT>
   <script language="JScript">
   <!--
function initAd1() {
   document.all.QQLayer.style.posTop = 100;//设置onLoad事件激发以后,广告层相对于固定后的y方向位置
   document.all.QQLayer.style.visibility = 'visible'//设置层为可见
   MoveLayer1('QQLayer');//调用函数MoveLayer1()
   }
   function MoveLayer1(layerName1) {
   if (document.body.offsetWidth >= 1024){
        var xx = document.body.offsetWidth/2 + 740/2 +20;
        var yy= document.body.offsetHeight - 650;
    }
    else{
        var xx = document.body.offsetWidth - 10;
        var yy= document.body.offsetHeight - 400;
    }
   var diff1 = (document.body.scrollTop + yy - document.all.QQLayer.style.posTop)*.40;
   var yy = document.body.scrollTop + yy - diff1;
   eval("document.all." + layerName1 + ".style.posTop = yy";
   //eval("document.all." + layerName1 + ".style.posLeft = xx";//移动广告层
   setTimeout("MoveLayer1('QQLayer');", 20);//设置20毫秒后再调用函数MoveLayer1()
   }
   //-->
   </script>

<SCRIPT FOR=window EVENT=onload LANGUAGE="JScript">
   initDH();//载入页面后,调用函数initDH()
   </SCRIPT>
   <script language="JScript">
   <!--
   function initDH(){
   document.all.DHLayer.style.posTop = 100;//设置onLoad事件激发以后,广告层相对于固定后的y方向位置
   document.all.DHLayer.style.visibility = 'visible'//设置层为可见
   MoveLayer('DHLayer');//调用函数MoveLayer()
   }
   function MoveLayer(layerName) {
   if (document.body.offsetWidth >= 1024){
        var x = document.body.offsetWidth/2 + 740/2 +20;
        var y= document.body.offsetHeight - 650;
    }
    else{
        var x = document.body.offsetWidth - 10;
        var y= document.body.offsetHeight - 400;
    }
   var diff = (document.body.scrollTop + y - document.all.DHLayer.style.posTop)*.40;
   var y = document.body.scrollTop + y - diff;
   eval("document.all." + layerName + ".style.posTop = y";
   eval("document.all." + layerName + ".style.posLeft = x";//移动广告层
   setTimeout("MoveLayer('DHLayer');", 20);//设置20毫秒后再调用函数MoveLayer()
   }
   //-->
   </script>
========
不管怎么改,好象只执行与DIV近的一个事法