日期:2014-05-18  浏览次数:20401 次

救命啊!!!!! 在ascx里不能实现无缝图片滚动!大侠帮我看看`50分相送!
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="zhuanqu.ascx.cs" Inherits="control_zhuanqu" %>
<table width="750" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
  <tr>
  <td width="40"><img src="../images/zhuanqu.gif" width="40" height="116"></td>
  <td>
<!--滚动开始 -->

<table width="700" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <td height="116"> 
<div id=demo style=overflow:hidden> 
 
<table width="600" height="100" border="0" cellpadding="0" cellspacing="5">
  <tr>
  <td id=demo1 valign=top width="150" height="100" align="left" valign="middle" background="../images/backzhuanqu.gif" ><div align="center"><img src="../images/zhuanqu-6.jpg" width="140" height="90"></div></td>
  <td width="150" height="100" background="../images/backzhuanqu.gif"><div align="center">
  <p><img src="../images/2.jpg" width="140" height="90"></p>
  </div></td>
  <td width="150" height="100" background="../images/backzhuanqu.gif"><div align="center"><img src="../images/zhuanqu-7.jpg" width="140" height="90"></div></td>
  <td width="150" height="100" background="../images/backzhuanqu.gif"><div align="center"><img src="../images/1.jpg" width="140" height="90"></div></td>  
<td id=demo2 valign=top></td>  
  </tr>
  </table>
</div> 
<script>
var speed=30
demo2.innerHTML=demo1.innerHTML
function Marque(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marque,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marque,speed)}
  </script>

</td>
  </tr>
  </table>

<!--滚动结束 --> </td>
  </tr>
</table>
   

怎么也滚动不起来``也不知道怎么回事```弄了一下午了``

------解决方案--------------------
那是因为你的条件不能满足if(demo2.offsetWidth-demo.scrollLeft <=0) 
多弄些图片就可以了.