我要实现:网页两侧广告条跟着屏幕向下滚动而滚动,但要求广告在某个区域里滚动,例如网页的长为1500像素,要求广告条在1000-1500像素之间滚动(也就是当网页滚动到1000像素时,广告条才跟着屏幕的滚动而滚动)

解决方案 »

  1.   

    应该是这个意思吧,你自己再改改 
    <SCRIPT language=JavaScript>
    function KB_keepItInIE(theName,theWantTop,theWantLeft) {
    theRealTop=parseInt(document.body.scrollTop)
    theTrueTop=theWantTop+theRealTop
    document.all[theName].style.top=theTrueTop
    theRealLeft=parseInt(document.body.scrollLeft)
    theTrueLeft=theWantLeft+theRealLeft
    document.all[theName].style.left=theTrueLeft
    }
    function KB_keepItInNN(theName,theWantX,theWantY) {
    theRealLay=document.layers[theName]
    theBadX=self.pageYOffset
    theBadY=self.pageXOffset
    theRealX=theBadX+theWantX
    theRealY=theBadY+theWantY
    theRealLay.moveTo(theRealY,theRealX)
    }
    IE4=(document.all)?1:0
    NN4=(document.layers)?1:0
    if (IE4)
    setInterval('KB_keepItInIE("KBStatic",0,0)',1)
    if (NN4)
    setInterval('KB_keepItInNN("KBStatic",0,0)',1)
    </SCRIPT>