问题描述
js代码<scriptlanguage="JavaScript"type="text/javascript">varSpeed=1;//速度(毫秒)varSpace=20;//每次移动(px)varPageWidth=800;//翻页宽度varfill=0;//整体移位varMoveLock=false;varMoveTimeObj;varComp=0;varAutoPlayObj=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();functionGetObj(objName){if(document.getElementById){returneval('document.getElementById("'+objName+'")')}else{returneval('document.all.'+objName)}}functionAutoPlay(){//自动滚动clearInterval(AutoPlayObj);AutoPlayObj=setInterval('ISL_GoDown();ISL_StopDown();',3000);//间隔时间}functionISL_GoUp(){//上翻开始if(MoveLock)return;clearInterval(AutoPlayObj);MoveLock=true;MoveTimeObj=setInterval('ISL_ScrUp();',Speed);}functionISL_StopUp(){//上翻停止clearInterval(MoveTimeObj);if(GetObj('ISL_Cont').scrollLeft%PageWidth-fill!=0){Comp=fill-(GetObj('ISL_Cont').scrollLeft%PageWidth);CompScr();}else{MoveLock=false;}AutoPlay();}functionISL_ScrUp(){//上翻动作if(GetObj('ISL_Cont').scrollLeft<=0){GetObj('ISL_Cont').scrollLeft=GetObj('ISL_Cont').scrollLeft+GetObj('List1').offsetWidth}GetObj('ISL_Cont').scrollLeft-=Space;}functionISL_GoDown(){//下翻clearInterval(MoveTimeObj);if(MoveLock)return;clearInterval(AutoPlayObj);MoveLock=true;ISL_ScrDown();MoveTimeObj=setInterval('ISL_ScrDown()',Speed);}functionISL_StopDown(){//下翻停止clearInterval(MoveTimeObj);if(GetObj('ISL_Cont').scrollLeft%PageWidth-fill!=0){Comp=PageWidth-GetObj('ISL_Cont').scrollLeft%PageWidth+fill;CompScr();}else{MoveLock=false;}AutoPlay();}functionISL_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;}functionCompScr(){varnum;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>样式和div代码<styletype="text/css">#Con{position:relative;width:800px;height:450px;}#Con.Scroll{float:left;width:800px;height:450px;}#Con.Scrollimg{width:800px;height:450px;}#Con:hovera.dirl{width:45px;height:64px;display:block;background-image:url('Images/http/L-1.png');position:absolute;left:0;top:200px;background-color:#808080;filter:alpha(opacity=50);-moz-opacity:0.5;-khtml-opacity:0.5;opacity:0.5;cursor:pointer;}#Cona.dirl{width:45px;height:64px;display:none;background-image:url('Images/http/L-1.png');position:absolute;left:0;top:200px;}#Cona.dirl:hover{background-image:url('Images/http/L-2.png');}#Con:hovera.dirr{width:45px;height:64px;display:block;background-image:url('Images/http/R-1.png');position:absolute;right:0;top:200px;background-color:#808080;filter:alpha(opacity=50);-moz-opacity:0.5;-khtml-opacity:0.5;opacity:0.5;cursor:pointer;}#Cona.dirr{width:45px;height:64px;display:none;background-image:url('Images/http/R-1.png');position:absolute;right:0;top:200px;}#Cona.dirr:hover{background-image:url('Images/http/R-2.png');}/*滚动样式*/.rollBox{width:800px;overflow:hidden;height:450px;}.rollBox.Cont{width:800px;height:450px;overflow:hidden;float:left;}.rollBox.ScrCont{width:10000000px;}.rollBox#List1,.rollBox#List2{float:left;}</style></head><body><%--div盒子模型,高度,宽度放内容--%><divid="Con"><divclass="rollBox"><divclass="Cont"id="ISL_Cont"><divclass="ScrCont"><divid="List1"><!--图片列表begin--><%--滚动内容开始--%><divclass="Scroll"><imgsrc="Images/Scroll/1.jpg"/></div><%--滚动内容结束--%><%--滚动内容开始--%><divclass="Scroll"><imgsrc="Images/Scroll/2.jpg"/></div><%--滚动内容结束--%><%--滚动内容开始--%><divclass="Scroll"><imgsrc="Images/Scroll/3.jpg"/></div><%--滚动内容结束--%><%--滚动内容开始--%><divclass="Scroll"><imgsrc="Images/Scroll/4.jpg"/></div><%--滚动内容结束--%><!--图片列表end--></div><divid="List2"></div></div></div></div><%--左右切换按钮--%><ahref="#"class="dirl"onmousedown="ISL_GoUp()"onmouseup="ISL_StopUp()"onmouseout="ISL_StopUp()"></a><ahref="#"class="dirr"onmousedown="ISL_GoDown()"onmouseup="ISL_StopDown()"onmouseout="ISL_StopDown()"></a><%--左右却换按钮结束--%></div></body>
解决方案
解决方案二:
没有html5支持渲染?
解决方案三:
js报错和HTML5渲染有啥关系呢?