这个很简单,就是你的整体下移动,你想的方法应该是给clientX赋值就是了

解决方案 »

  1.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    <SCRIPT LANGUAGE="JavaScript">
    <!--function test() { if (event.clientY>document.all.dv.style.top.substring(0,document.all.dv.style.top.length-2)) {
    document.all.dv.scrollTop =140;
    } else {
    document.all.dv.scrollTop =ddd;
    }
    }
    //-->
    </SCRIPT>
    </HEAD><BODY onmousemove="test()">
    <div id="dv" style="position:absolute;top:50;left:49;width:100;height:100;overflow-x:scroll;overflow-y:scroll">aaaaaaaaaaa<br>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<br>aaaaaaaaaaaaaaaaaaa<br>aaaaaaaaaaaaaaaaaaaa<br>aaaaaaaaaaaaaaaaa<br>aaaaaaaaaaaaaaaaaaaa<br>dsfsdfs</div>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    var ddd = document.all.dv.scrollTop;
    //-->
    </SCRIPT>
    </BODY>
    </HTML>
      

  2.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE>Mouse Scroll</TITLE>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    var mousestatus = false;
    var cpos = 0;function switchmode() {
    mousestatus = !mousestatus;
    if(mousestatus){
    tt.style.display = '';
    tt.style.left = 0;
    cpos = mybody.clientHeight / 2 ;
    tt.style.top = document.body.scrollTop + cpos ;
    tt.style.left = document.body.clientWidth / 2;
    //alert( document.body.scrollTop );
    }
    else{
    tt.style.display='none';
    }
    }function Conmousemove(){
       if (mousestatus)
        {
    if(event.clientY > cpos){
    //alert (event.clientY - cpos);
    tt1.style.color = "#000000";
    tt2.style.color = "#FF0000";
    document.body.scrollTop = document.body.scrollTop + event.clientY - cpos;
    tt.style.top = document.body.scrollTop + cpos ;
    }
    else{
    //alert (cpos - event.clientY);
    tt1.style.color = "#FF0000";
    tt2.style.color = "#000000";
    document.body.scrollTop = document.body.scrollTop + event.clientY - cpos;
    tt.style.top = document.body.scrollTop + cpos ;
    }
        }
    }
    //-->
    </SCRIPT>
    </HEAD><BODY onmousemove="Conmousemove()" onmousedown="switchmode()" id="mybody">
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <P>this is a test page</P>
    <table  id="tt" style="position:absolute;width:0px;display:none;height:0px;color:#000000;z-index:99;">
    <tr>
    <td valign="middle" id="tt1">↑</td>
    </tr>
    <tr>
    <td valign="middle" id="tt2">↓</td>
    </tr>
    </table></BODY>
    </HTML>鼠标左键点击切换滚动模式。