这个效果是我从网上找的。可以实现点击滚动,但是网站上要做6个这样的滚动。本人技术有限改了半下午还是出不来,只能实现出单排的滚动。高手帮忙看一下。
<!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" />
<meta name="keywords" content="站长,网页特效,js特效,广告代码,zzjs,zzjs.net,sky,www.zzjs.net,站长特效 网" />
<meta name="description" content="www.zzjs.net,站长特效网,站长必备js特效及广告代码。大量高质量js特效,提供高质量广告代码下载,尽在站长特效网" />
<title>图片自动滚动效果,sky整理搜集。</title>
</head>
<style type="text/css">
<!--
.rollBox{width:704px;overflow:hidden;padding:12px 0 5px 6px;}
.rollBox .LeftBotton{height:52px;width:19px;background:url(/img/job_mj_069.gif) no-repeat 11px 0;overflow:hidden;float:left;display:inline;margin:25px 0 0 0;cursor:pointer;}
.rollBox .RightBotton{height:52px;width:20px;background:url(/img/job_mj_069.gif) no-repeat -8px 0;overflow:hidden;float:left;display:inline;margin:25px 0 0 0;cursor:pointer;}
.rollBox .Cont{width:530px;overflow:hidden;float:left;}
.rollBox .ScrCont{width:10000000px;}
.rollBox .Cont .pic{width:132px;float:left;text-align:center;}
.rollBox .Cont .pic img{padding:4px;background:#fff;border:1px solid #ccc;display:block;margin:0 auto;}
.rollBox .Cont .pic p{line-height:26px;color:#505050;}
.rollBox .Cont a:link,.rollBox .Cont a:visited{color:#626466;text-decoration:none;}
.rollBox .Cont a:hover{color:#f00;text-decoration:underline;}
.rollBox #List1,.rollBox #List2{float:left;}
-->
</style>
<body>
<a href=" http://www.zzjs.net/">站长特效网</a>,站长必备的高质量网页特效和广告代码。zzjs.net,站长js特效。<hr>
<!--欢迎来到站长特效网,我们网站收集大量高质量js特效,提供许多广告代码下载,网址:www.zzjs.net,[email protected],用.net打造靓站-->
<div class="rollBox">
    <div class="LeftBotton" onmousedown="ISL_GoUp()" onmouseup="ISL_StopUp()" onmouseout="ISL_StopUp()">11</div>
        <div class="Cont" id="ISL_Cont">
            <div class="ScrCont">
                <div id="List1">
                <!-- 图片列表 begin -->
                <div class="pic">
                <a href=" http://zzjs.net" target="_blank"><img src="/ad/1.gif" width="109" height="87" alt="一号图片" /></a>
                <p><a href=" http://www.zzjs.net" target="_blank">一号图片</a></p>
                </div>
                <div class="pic">
                <a href=" http://zzjs.net" target="_blank"><img src="/ad/1.gif" width="109" height="87" alt="二号图片" /></a>
                <p><a href=" http://www.zzjs.net" target="_blank">二号图片</a></p>
                </div>
                <div class="pic">
                <a href=" http://www.zzjs.net" target="_blank"><img src="/ad/3.gif" width="109" height="87" alt="三号图片" /></a>
                <p><a href=" http://zzjs.net" target="_blank">三号图片</a></p>
                </div>
                <div class="pic">
                <a href=" http://www.zzjs.net" target="_blank"><img src="/ad/4.gif" width="109" height="87" alt="四号图片" /></a>
                <p><a href=" http://zzjs.net" target="_blank">四号图片</a></p>
                </div>
                <div class="pic">
                <a href=" http://www.zzjs.net" target="_blank"><img src="/ad/5.gif" width="109" height="87" alt="五号图片" /></a>
                <p><a href=" http://zzjs.net" target="_blank">五号图片</a></p>
                </div>
                <div class="pic">
                <a href=" http://www.zzjs.net" target="_blank"><img src="/ad/1.gif" width="109" height="87" alt="您自定义" /></a>
                <p><a href=" http://zzjs.net" target="_blank">您自定义</a></p>
                </div>
                <div class="pic">
                <a href=" http://www.zzjs.net" target="_blank"><img src="/ad/1.gif" width="109" height="87" alt="您自定义" /></a>
                <p><a href=" http://zzjs.net" target="_blank">您自定义</a></p>
                </div>
                <!-- 图片列表 end -->
                </div>
             <div id="List2"></div>
            </div>
        </div>
    <div class="RightBotton" onmousedown="ISL_GoDown()" onmouseup="ISL_StopDown()" onmouseout="ISL_StopDown()">22</div>
</div>
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
//图片滚动列表 mengjia 070816
var Speed = 10; //速度(毫秒)
var Space = 35; //每次移动(px)
var PageWidth = 132; //翻页宽度
var fill = 0; //整体移位
var MoveLock = false;
var MoveTimeObj;
var Comp = 0;
var AutoPlayObj = null;
GetObj("List2").innerHTML = GetObj("List1").innerHTML;
GetObj('ISL_Cont').scrollLeft = fill;
GetObj("ISL_Cont").onmouseover = function(){clearInterval(AutoPlayObj);}
GetObj("ISL_Cont").onmouseout = function(){AutoPlay();}
AutoPlay();
function GetObj(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval('document.all.'+objName)}}
function AutoPlay(){ //自动滚动
 clearInterval(AutoPlayObj);
 AutoPlayObj = setInterval('ISL_GoDown();ISL_StopDown();',3000); //间隔时间
}//欢迎来到站长特效网,我们的网址是www.zzjs.net,很好记,zz站长,js就是js特效,本站收集大量高质量js代码,还有许多广告代码下载。
function ISL_GoUp(){ //上翻开始
 if(MoveLock) return;
 clearInterval(AutoPlayObj);
 MoveLock = true;
 MoveTimeObj = setInterval('ISL_ScrUp();',Speed);
}
function ISL_StopUp(){ //上翻停止
 clearInterval(MoveTimeObj);
 if(GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0){
  Comp = fill - (GetObj('ISL_Cont').scrollLeft % PageWidth);
  CompScr();
 }else{
  MoveLock = false;
 }
 AutoPlay();
}//欢迎来到站长特效网,我们的网址是www.zzjs.net,很好记,zz站长,js就是js特效,本站收集大量高质量js代码,还有许多广告代码下载。
function ISL_ScrUp(){ //上翻动作
 if(GetObj('ISL_Cont').scrollLeft <= 0){GetObj('ISL_Cont').scrollLeft = GetObj('ISL_Cont').scrollLeft + GetObj('List1').offsetWidth}
 GetObj('ISL_Cont').scrollLeft -= Space ;
}
function ISL_GoDown(){ //下翻
 clearInterval(MoveTimeObj);
 if(MoveLock) return;
 clearInterval(AutoPlayObj);
 MoveLock = true;
 ISL_ScrDown();
 MoveTimeObj = setInterval('ISL_ScrDown()',Speed);
}
function ISL_StopDown(){ //下翻停止
 clearInterval(MoveTimeObj);
 if(GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0 ){
  Comp = PageWidth - GetObj('ISL_Cont').scrollLeft % PageWidth + fill;
  CompScr();
 }else{
  MoveLock = false;
 }
 AutoPlay();
}//欢迎来到站长特效网,我们的网址是www.zzjs.net,很好记,zz站长,js就是js特效,本站收集大量高质量js代码,还有许多广告代码下载。
function ISL_ScrDown(){ //下翻动作
 if(GetObj('ISL_Cont').scrollLeft >= GetObj('List1').scrollWidth){GetObj('ISL_Cont').scrollLeft = GetObj('ISL_Cont').scrollLeft - GetObj('List1').scrollWidth;}
 GetObj('ISL_Cont').scrollLeft += Space ;
}
function CompScr(){
 var num;
 if(Comp == 0){MoveLock = false;return;}
 if(Comp < 0){ //上翻
  if(Comp < -Space){
   Comp += Space;
   num = Space;
  }else{
   num = -Comp;
   Comp = 0;
  }
  GetObj('ISL_Cont').scrollLeft -= num;
  setTimeout('CompScr()',Speed);
 }else{ //下翻
  if(Comp > Space){
   Comp -= Space;
   num = Space;
  }else{
   num = Comp;
   Comp = 0;
  }
  GetObj('ISL_Cont').scrollLeft += num;
  setTimeout('CompScr()',Speed);
 }
}//左右移动显示
 
var marginCount = new Array(8);
for(var i=1;i<marginCount.length;i++){
marginCount[i]=0;
}
 
function resetMargin(divid,Direction){
    var liarr = $(divid).getElementsByTagName("li");
var liarrlen = liarr.length;
var len = divid.length;
var i = divid.substring(len-1,len);
if(Direction=="right"){
if(marginCount[i]<liarrlen-5){
marginCount[i]++;
$(divid).style.marginLeft=-132*marginCount[i];
}
}
else{
if(marginCount[i]>0){
marginCount[i]--;
$(divid).style.marginLeft=-132*marginCount[i];
}

}
}
initCityListForIndex();
getCitiesForIndex();
//--><!]]>
</script>
</body>
</html>

解决方案 »

  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" />
    <meta name="keywords" content="站长,网页特效,js特效,广告代码,zzjs,zzjs.net,sky,www.zzjs.net,站长特效 网" />
    <meta name="description" content="www.zzjs.net,站长特效网,站长必备js特效及广告代码。大量高质量js特效,提供高质量广告代码下载,尽在站长特效网" />
    <title>图片自动滚动效果,sky整理搜集。</title>
    </head>
    <style type="text/css">
    <!--
    .rollBox{width:704px;overflow:hidden;padding:12px 0 5px 6px;}
    .rollBox .LeftBotton{height:52px;width:19px;background:url(/img/job_mj_069.gif) no-repeat 11px 0;overflow:hidden;float:left;display:inline;margin:25px 0 0 0;cursor:pointer;}
    .rollBox .RightBotton{height:52px;width:20px;background:url(/img/job_mj_069.gif) no-repeat -8px 0;overflow:hidden;float:left;display:inline;margin:25px 0 0 0;cursor:pointer;}
    .rollBox .Cont{width:530px;overflow:hidden;float:left;}
    .rollBox .ScrCont{width:10000000px;}
    .rollBox .Cont .pic{width:132px;float:left;text-align:center;}
    .rollBox .Cont .pic img{padding:4px;background:#fff;border:1px solid #ccc;display:block;margin:0 auto;}
    .rollBox .Cont .pic p{line-height:26px;color:#505050;}
    .rollBox .Cont a:link,.rollBox .Cont a:visited{color:#626466;text-decoration:none;}
    .rollBox .Cont a:hover{color:#f00;text-decoration:underline;}
    .rollBox #List1,.rollBox #List2{float:left;}
    -->
    </style>
    <body>
    <a href=" http://www.zzjs.net/">站长特效网</a>,站长必备的高质量网页特效和广告代码。zzjs.net,站长js特效。<hr>
    <!--欢迎来到站长特效网,我们网站收集大量高质量js特效,提供许多广告代码下载,网址:www.zzjs.net,[email protected],用.net打造靓站-->
    <div class="rollBox">
        <div class="LeftBotton" onmousedown="ISL_GoUp()" onmouseup="ISL_StopUp()" onmouseout="ISL_StopUp()">11</div>
            <div class="Cont" id="ISL_Cont">
                <div class="ScrCont">
                    <div id="List1">
                    <!-- 图片列表 begin -->
                    <div class="pic">
                    <a href=" http://zzjs.net" target="_blank"><img src="/ad/1.gif" width="109" height="87" alt="一号图片" /></a>
                    <p><a href=" http://www.zzjs.net" target="_blank">一号图片</a></p>
                    </div>
                    <div class="pic">
                    <a href=" http://zzjs.net" target="_blank"><img src="/ad/1.gif" width="109" height="87" alt="二号图片" /></a>
                    <p><a href=" http://www.zzjs.net" target="_blank">二号图片</a></p>
                    </div>
                    <div class="pic">
                    <a href=" http://www.zzjs.net" target="_blank"><img src="/ad/3.gif" width="109" height="87" alt="三号图片" /></a>
                    <p><a href=" http://zzjs.net" target="_blank">三号图片</a></p>
                    </div>
                    <div class="pic">
                    <a href=" http://www.zzjs.net" target="_blank"><img src="/ad/4.gif" width="109" height="87" alt="四号图片" /></a>
                    <p><a href=" http://zzjs.net" target="_blank">四号图片</a></p>
                    </div>
                    <div class="pic">
                    <a href=" http://www.zzjs.net" target="_blank"><img src="/ad/5.gif" width="109" height="87" alt="五号图片" /></a>
                    <p><a href=" http://zzjs.net" target="_blank">五号图片</a></p>
                    </div>
                    <div class="pic">
                    <a href=" http://www.zzjs.net" target="_blank"><img src="/ad/1.gif" width="109" height="87" alt="您自定义" /></a>
                    <p><a href=" http://zzjs.net" target="_blank">您自定义</a></p>
                    </div>
                    <div class="pic">
                    <a href=" http://www.zzjs.net" target="_blank"><img src="/ad/1.gif" width="109" height="87" alt="您自定义" /></a>
                    <p><a href=" http://zzjs.net" target="_blank">您自定义</a></p>
                    </div>
                    <!-- 图片列表 end -->
                    </div>
                 <div id="List2"></div>
                </div>
            </div>
        <div class="RightBotton" onmousedown="ISL_GoDown()" onmouseup="ISL_StopDown()" onmouseout="ISL_StopDown()">22</div>
    </div>
    <script language="javascript" type="text/javascript">
    <!--//--><![CDATA[//><!--
    //图片滚动列表 mengjia 070816
    var Speed = 10; //速度(毫秒)
    var Space = 35; //每次移动(px)
    var PageWidth = 132; //翻页宽度
    var fill = 0; //整体移位
    var MoveLock = false;
    var MoveTimeObj;
    var Comp = 0;
    var AutoPlayObj = null;
    GetObj("List2").innerHTML = GetObj("List1").innerHTML;
    GetObj('ISL_Cont').scrollLeft = fill;
    GetObj("ISL_Cont").onmouseover = function(){clearInterval(AutoPlayObj);}
    GetObj("ISL_Cont").onmouseout = function(){AutoPlay();}
    AutoPlay();
    function GetObj(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval('document.all.'+objName)}}
    function AutoPlay(){ //自动滚动
     clearInterval(AutoPlayObj);
     AutoPlayObj = setInterval('ISL_GoDown();ISL_StopDown();',3000); //间隔时间
    }//欢迎来到站长特效网,我们的网址是www.zzjs.net,很好记,zz站长,js就是js特效,本站收集大量高质量js代码,还有许多广告代码下载。
    function ISL_GoUp(){ //上翻开始
     if(MoveLock) return;
     clearInterval(AutoPlayObj);
     MoveLock = true;
     MoveTimeObj = setInterval('ISL_ScrUp();',Speed);
    }
    function ISL_StopUp(){ //上翻停止
     clearInterval(MoveTimeObj);
     if(GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0){
      Comp = fill - (GetObj('ISL_Cont').scrollLeft % PageWidth);
      CompScr();
     }else{
      MoveLock = false;
     }
     AutoPlay();
    }//欢迎来到站长特效网,我们的网址是www.zzjs.net,很好记,zz站长,js就是js特效,本站收集大量高质量js代码,还有许多广告代码下载。
    function ISL_ScrUp(){ //上翻动作
     if(GetObj('ISL_Cont').scrollLeft <= 0){GetObj('ISL_Cont').scrollLeft = GetObj('ISL_Cont').scrollLeft + GetObj('List1').offsetWidth}
     GetObj('ISL_Cont').scrollLeft -= Space ;
    }
    function ISL_GoDown(){ //下翻
     clearInterval(MoveTimeObj);
     if(MoveLock) return;
     clearInterval(AutoPlayObj);
     MoveLock = true;
     ISL_ScrDown();
     MoveTimeObj = setInterval('ISL_ScrDown()',Speed);
    }
    function ISL_StopDown(){ //下翻停止
     clearInterval(MoveTimeObj);
     if(GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0 ){
      Comp = PageWidth - GetObj('ISL_Cont').scrollLeft % PageWidth + fill;
      CompScr();
     }else{
      MoveLock = false;
     }
     AutoPlay();
    }//欢迎来到站长特效网,我们的网址是www.zzjs.net,很好记,zz站长,js就是js特效,本站收集大量高质量js代码,还有许多广告代码下载。
    function ISL_ScrDown(){ //下翻动作
     if(GetObj('ISL_Cont').scrollLeft >= GetObj('List1').scrollWidth){GetObj('ISL_Cont').scrollLeft = GetObj('ISL_Cont').scrollLeft - GetObj('List1').scrollWidth;}
     GetObj('ISL_Cont').scrollLeft += Space ;
    }
    function CompScr(){
     var num;
     if(Comp == 0){MoveLock = false;return;}
     if(Comp < 0){ //上翻
      if(Comp < -Space){
       Comp += Space;
       num = Space;
      }else{
       num = -Comp;
       Comp = 0;
      }
      GetObj('ISL_Cont').scrollLeft -= num;
      setTimeout('CompScr()',Speed);
     }else{ //下翻
      if(Comp > Space){
       Comp -= Space;
       num = Space;
      }else{
       num = Comp;
       Comp = 0;
      }
      GetObj('ISL_Cont').scrollLeft += num;
      setTimeout('CompScr()',Speed);
     }
    }//--><!]]>
    </script>
    </body>
    </html>
      

  2.   

    楼主我告诉你一个方法。
    你把这6块做成iframe。这样就不用改这个代码了~·
    然后主页引用进来这6个iframe就成了,代码也没有冲突