<!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=gb2312" /><title>Untitled Document</title><style>* {margin:0;padding:0; }#demo{Overflow:Hidden; /*must be added hideen to scroll*/width:840px;margin:50px Auto; }#demo img{Border:1px solid Red;Margin-right:20px; }#indemo{float: Left;width:800%;Border:1px dashed #000; }#demo1{float: Left; }#demo2{float: Left; }</style></Head><Body><DivID= "Demo"> <DivID= "Indemo"> <DivID= "Demo1"> <ahref="###"><imgsrc= "1.jpg"width= "+"Height= "a"Border= "0" /></a> <ahref="###"><imgsrc= "1.jpg"width= "+"Height= "a"Border= "0" /></a> <ahref="###"><imgsrc= "1.jpg"width= "+"Height= "a"Border= "0" /></a> <ahref="###"><imgsrc= "1.jpg"width= "+"Height= "a"Border= "0" /></a> <ahref="###"><imgsrc= "1.jpg"width= "+"Height= "a"Border= "0" /></a> <ahref="###"><imgsrc= "1.jpg"width= "+"Height= "a"Border= "0" /></a> </Div> <DivID= "Demo2"></Div> </Div></Div><Script> var Speed= the; varTab=document.getElementById ("Demo"); varTAB1=document.getElementById ("Demo1"); vartab2=document.getElementById ("Demo2"); Tab2.innerhtml=tab1.innerhtml; functionMarquee () {if(Tab2.offsetwidth-Tab.scrollleft<= 0) Tab.scrollleft-=Tab1.offsetwidth; Else{tab.scrollleft++; } } varMyMar=setinterval (Marquee, speed); Tab.onmouseover= function() {clearinterval (MyMar)}; Tab.onmouseout= function() {MyMar=setinterval (Marquee, Speed)};</Script></Body></HTML>
Obj.offsetwidth refers to the absolute width of the obj control itself, excluding parts that are not displayed because of overflow, that is, its actual occupied width, integer type, unit pixels.
ScrollLeft refers to the width of the part that is not visible on the left after the horizontal scroll bar is scrolled.
JS Seamless scrolling Merry