日期:2014-05-16  浏览次数:20364 次

自动滚动图片JS滚着滚着就没有了
以下是全部的代码,有没有哪位朋友帮忙分析一下是哪里问题呢.
CSS code

<style type="text/css">
<!--
#RBottom_Main
{
    width:736px;
    height:160px;
    overflow:hidden;
}
.BMLeftArr1
{
    float:left;
    width:12px;
    cursor: pointer;
    height:160px;
    margin:0px;
    line-height:160px;
}
.BMISL_Cont
{
    float:left;
    width:712px;
    height:160px;
    margin:0px;
    overflow: hidden;
}
.pic
{
    float:left;
    text-align:center;
    margin:0px;
    padding:0px;
    width:356px;
    height:160px;
}
.BMRightArr1
{
    float:left;
    width:12px;
    cursor: pointer;
    height:160px;
    line-height:160px;
}
.ScrCont{width:10000000px;}
.#List1,#List2{float:left;}
-->
</style>



HTML code

 <div id="RBottom_Main">
      <div class="BMLeftArr1" onmousedown="ISL_GoUp()" onmouseup="ISL_StopUp()" onmouseout="ISL_StopUp()">&lt;</div>
      <div class="BMISL_Cont" id="ISL_Cont">
      <div class="ScrCont">
      <!-- 图片列表 begin -->
      <div id="List1">
      <div class="pic" style="background-color:#0000FF"></div>
      <div class="pic" style="background-color:#00FFFF"></div>
      <div class="pic" style="background-color:#000000"></div>
      </div>
      <!-- 图片列表 end -->
      <div id="List2"></div>
      </div>
      </div>
      <div class="BMRightArr1" onmousedown="ISL_GoDown()" onmouseup="ISL_StopDown()" onmouseout="ISL_StopDown()">&gt;</div>
      </div>
</div>


JScript code

<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
//图片滚动列表 5icool.org
var Speed = 1; //速度(毫秒)
var Space = 5; //每次移动(px)
var PageWidth = 356; //翻页宽度
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); //间隔时间
}
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();
}
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