我在页面中 用repeater循环了一组图片 图片列表左右两侧 各有一个按钮 图片有八张 在页面中只能看见4张 点击按钮实现可看到其它图片

解决方案 »

  1.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
    <title>图片滚动</title>
    <style type="text/css">
    a { color:#213f71; font-size:9pt; text-decoration:none;}
    a:hover {color:#0066cc; }
    .blk_18 {
     overflow:hidden;
     zoom:1;
     font-size:9pt;
     border:1px solid #e3e3e3;
     background:#eee;
     width:692px;
     margin-top:8px;
    }
    .blk_18 .pcont {
     width:638px;
     float:left;
     overflow:hidden;
     padding-left:5px;
    }
    .blk_18 .ScrCont {
     width:32766px;
     zoom:1;
     margin-left:-5px;
    }
    .blk_18 #List1_1, .blk_18 #List2_1 {
     float:left;
    }
    .blk_18 .LeftBotton, .blk_18 .RightBotton {
     width:15px;
     height:74px;
     float:left;
     background:url(http://www.codefans.net/jscss/demoimg/200902/ax.gif) no-repeat;
    }
    .blk_18 .LeftBotton {
     background-position: 0 0;
     margin:8px 5px 0;
    }
    .blk_18 .RightBotton {
     background-position: 0 -100px;
     margin:8px 1px 10px 5px;
    }
    .blk_18 .LeftBotton:hover {
     background-position: -20px 0;
    }
    .blk_18 .RightBotton:hover {
     background-position: -20px -100px;
    }
    .blk_18 .pl img {
     display:block;
     cursor:pointer;
     border:none;
     margin:6px auto 1px auto;
    }
    .blk_18 .pl {
     width:105px;
     border:1px solid #f3f3f3;
     float:left;
     float:left;
     text-align:center;
     line-height:24px;
    }
    .blk_18 a.pl:hover {
     border:1px solid #5dacec;
     color:#5dacec;
     background:#fff;
    }
    </style>
    <script type="text/javascript">var Speed_1 = 10; //速度(毫秒)
    var Space_1 = 20; //每次移动(px)
    var PageWidth_1 = 107 * 6; //翻页宽度
    var interval_1 = 5000; //翻页间隔时间
    var fill_1 = 0; //整体移位
    var MoveLock_1 = false;
    var MoveTimeObj_1;
    var MoveWay_1="right";
    var Comp_1 = 0;
    var AutoPlayObj_1=null;
    function GetObj(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval('document.all.'+objName)}}
    function AutoPlay_1(){clearInterval(AutoPlayObj_1);AutoPlayObj_1=setInterval('ISL_GoDown_1();ISL_StopDown_1();',interval_1)}
    function ISL_GoUp_1(){if(MoveLock_1)return;clearInterval(AutoPlayObj_1);MoveLock_1=true;MoveWay_1="left";MoveTimeObj_1=setInterval('ISL_ScrUp_1();',Speed_1);}
    function ISL_StopUp_1(){if(MoveWay_1 == "right"){return};clearInterval(MoveTimeObj_1);if((GetObj('ISL_Cont_1').scrollLeft-fill_1)%PageWidth_1!=0){Comp_1=fill_1-(GetObj('ISL_Cont_1').scrollLeft%PageWidth_1);CompScr_1()}else{MoveLock_1=false}
    AutoPlay_1()}
    function ISL_ScrUp_1(){if(GetObj('ISL_Cont_1').scrollLeft<=0){GetObj('ISL_Cont_1').scrollLeft=GetObj('ISL_Cont_1').scrollLeft+GetObj('List1_1').offsetWidth}
    GetObj('ISL_Cont_1').scrollLeft-=Space_1}
    function ISL_GoDown_1(){clearInterval(MoveTimeObj_1);if(MoveLock_1)return;clearInterval(AutoPlayObj_1);MoveLock_1=true;MoveWay_1="right";ISL_ScrDown_1();MoveTimeObj_1=setInterval('ISL_ScrDown_1()',Speed_1)}
    function ISL_StopDown_1(){if(MoveWay_1 == "left"){return};clearInterval(MoveTimeObj_1);if(GetObj('ISL_Cont_1').scrollLeft%PageWidth_1-(fill_1>=0?fill_1:fill_1+1)!=0){Comp_1=PageWidth_1-GetObj('ISL_Cont_1').scrollLeft%PageWidth_1+fill_1;CompScr_1()}else{MoveLock_1=false}
    AutoPlay_1()}
    function ISL_ScrDown_1(){if(GetObj('ISL_Cont_1').scrollLeft>=GetObj('List1_1').scrollWidth){GetObj('ISL_Cont_1').scrollLeft=GetObj('ISL_Cont_1').scrollLeft-GetObj('List1_1').scrollWidth}
    GetObj('ISL_Cont_1').scrollLeft+=Space_1}
    function CompScr_1(){if(Comp_1==0){MoveLock_1=false;return}
    var num,TempSpeed=Speed_1,TempSpace=Space_1;if(Math.abs(Comp_1)<PageWidth_1/2){TempSpace=Math.round(Math.abs(Comp_1/Space_1));if(TempSpace<1){TempSpace=1}}
    if(Comp_1<0){if(Comp_1<-TempSpace){Comp_1+=TempSpace;num=TempSpace}else{num=-Comp_1;Comp_1=0}
    GetObj('ISL_Cont_1').scrollLeft-=num;setTimeout('CompScr_1()',TempSpeed)}else{if(Comp_1>TempSpace){Comp_1-=TempSpace;num=TempSpace}else{num=Comp_1;Comp_1=0}
    GetObj('ISL_Cont_1').scrollLeft+=num;setTimeout('CompScr_1()',TempSpeed)}}
    function picrun_ini(){
    GetObj("List2_1").innerHTML=GetObj("List1_1").innerHTML;
    GetObj('ISL_Cont_1').scrollLeft=fill_1>=0?fill_1:GetObj('List1_1').scrollWidth-Math.abs(fill_1);
    GetObj("ISL_Cont_1").onmouseover=function(){clearInterval(AutoPlayObj_1)}
    GetObj("ISL_Cont_1").onmouseout=function(){AutoPlay_1()}
    AutoPlay_1();
    }
    </script>
    </head>
    <body>
    <!-- picrotate_left start  -->
    <div class="blk_18"> <a class="LeftBotton" onmousedown="ISL_GoUp_1()" onmouseup="ISL_StopUp_1()" onmouseout="ISL_StopUp_1()" href="javascript:void(0);" target="_self"></a>
      <div class="pcont" id="ISL_Cont_1">
        <div class="ScrCont">
          <div id="List1_1">
            <!-- piclist begin -->
            <a class="pl" href="#" ><img src="http://www.codefans.net/jscss/demoimg/wall_s1.jpg" alt="" width="96" height="72"/>图片一</a>
            <a class="pl"href="#"> <img src="http://www.codefans.net/jscss/demoimg/wall_s2.jpg" alt="" width="96" height="72"/>图片二</a>
            <a class="pl" href="#"><img src="http://www.codefans.net/jscss/demoimg/wall_s3.jpg" alt=""width="96" height="72"/>图片三</a>
            <a class="pl" href="#"><img src="http://www.codefans.net/jscss/demoimg/wall_s4.jpg" alt="" width="96" height="72"/>图片四</a>
            <a class="pl" href="#"><img src="http://www.codefans.net/jscss/demoimg/wall_s5.jpg" alt="" width="96" height="72"/>图片五</a>
            <a class="pl" href="#"><img src="http://www.codefans.net/jscss/demoimg/wall_s6.jpg" alt="" width="96" height="72"/>图片六</a>
            <a class="pl" href="#"><img src="http://www.codefans.net/jscss/demoimg/wall_s7.jpg" alt="" width="96" height="72"/>图片七</a>
            <a class="pl" href="#" ><img src="http://www.codefans.net/jscss/demoimg/wall_s8.jpg" alt="" width="96" height="72"/>图片八</a>
            <a class="pl" href="#" ><img src="http://www.codefans.net/jscss/demoimg/wall_s9.jpg" alt="" width="96" height="72"/>图片九</a>
            <!-- piclist end -->
          </div>
          <div id="List2_1"></div>
        </div>
      </div>
      <a class="RightBotton" onmousedown="ISL_GoDown_1()" onmouseup="ISL_StopDown_1()" onmouseout="ISL_StopDown_1()" href="javascript:void(0);" target="_self"></a> </div>
    <div class="c"></div>
    <script type="text/javascript">
            <!--
            picrun_ini()
            //-->
            </script>
    <!-- picrotate_left end -->
    </body>
    </html>