thead设置overflow:hidden
tbody设置overflow-y:hidden,overflow-x:hidden
还有就是你table要定宽高
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/htmlcharset=gb2312">
<TITLE>图片无缝滚动效果</TITLE>
<STYLE type="text/css">
#scrollImg{overflow:hiddenwidth:630pxheight:autoborder:1px solid #000000float:left}
</STYLE>
</HEAD>
<BODY>
<DIV id="scrollImg">
<TABLE cellspacing=0 cellpadding=0 align=left border=0>
<TBODY>
<TR>
<TD id="scrollImg1">
<TABLE height="100%" width="630" border=0>
<TBODY>
<TR>
<TD><IMG name="img1" src="" width="120" height="90" alt="" style="background-color: #D4D0C8"></TD>
<TD><IMG name="img2" src="" width="120" height="90" alt="" style="background-color: #D4D0C8"></TD>
<TD><IMG name="img3" src="" width="120" height="90" alt="" style="background-color: #D4D0C8"></TD>
<TD><IMG name="img4" src="" width="120" height="90" alt="" style="background-color: #D4D0C8"></TD>
<TD><IMG name="img5" src="" width="120" height="90" alt="" style="background-color: #D4D0C8"></TD>
<TD><IMG name="img6" src="" width="120" height="90" alt="" style="background-color: #D4D0C8"></TD>
<TD><IMG name="img7" src="" width="120" height="90" alt="" style="background-color: #D4D0C8"></TD>
<TD><IMG name="img8" src="" width="120" height="90" alt="" style="background-color: #D4D0C8"></TD>
</TR>
</TBODY>
</TABLE>
</TD>
<TD id="scrollImg2"></TD>
</TR>
</TBODY>
</TABLE>
<SCRIPT type=text/javascript LAGUAGE="javascript">
<!--
var leftspeed = 30//滚动速度,数值越大,滚动越慢
document.getElementById("scrollImg2").innerHTML = document.getElementById("scrollImg1").innerHTML
function MarqueeLeft(){
if(document.getElementById("scrollImg2").offsetWidth-document.getElementById("scrollImg").scrollLeft<=0)
document.getElementById("scrollImg").scrollLeft-=document.getElementById("scrollImg1").offsetWidth
else{
document.getElementById("scrollImg").scrollLeft++
}}
var MyMarleft = setInterval(MarqueeLeft, leftspeed)
document.getElementById("scrollImg").onmouseover=function() {clearInterval(MyMarleft)}
document.getElementById("scrollImg").onmouseout=function() {MyMarleft=setInterval(MarqueeLeft,leftspeed)}
//-->
</SCRIPT>
</DIV>
</BODY>
</HTML>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)