<div class= "box" >
<div class= "Box1" ></div>
<div class= "Box2" id= "Box2" >
<ul class= "List" >
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
<li>11</li>
<li>12</li>
</ul>
</div>
</div>
<script type= "Text/javascript" >
Window.onload=function () {
var Box2=document.getelementbyid (' Box2 ');
var oul=box2.getelementsbytagname (' ul ') [0];
var ali=oul.getelementsbytagname (' Li ');
var len=ali.length;
var w=ali[0].offsetwidth;
var index=0;
var b=true;
var timer=null;
function Next () {
b?index++:index--;
(index==0 | | index==len-1) && (b=!b);
Startmove (-INDEX*W);
}
SetInterval (next,2000);
function Domove (itarget) {
var ispeed= (itarget-oul.offsetleft)/14;
Ispeed = ispeed > 0? Math.ceil (ispeed): Math.floor (Ispeed);
Oul.offsetleft = = ITarget? Clearinterval (timer): OUl.style.left = oul.offsetleft + ispeed + "px";
};
function Startmove (itarget) {//alert (1);
Clearinterval (timer);
Timer=setinterval (function () {
Domove (ITarget);
},30)
};
};
</script>
JS AD picture Carousel