Datalist无隙滚动
Code
<div id="demo" style="overflow: hidden; width:636px; color: #ffffff; height: 90px;">
<table border="0" cellpadding="0" cellspacing="0" class="line2" style="margin-top: 5px; width:612px;">
<tr>
<td style="height:2px">
</td>
</tr>
<tr>
<td id="demo2" style="height: 90px" valign="middle" >
</td>
<td id="demo1" align="center" style="height: 90px" valign="middle">
<asp:DataList ID="DataList3" runat="server" RepeatDirection="Horizontal" RepeatColumns="8" Width="620px">
<ItemTemplate>
<table><tr><td style="width:145px" valign="middle" >
<a href='<%#Eval("imgUrl") %>'>
<img height="91px" width="140" src='<%#Eval("imgUrl") %>' style="border-style: none" /></a>
</td></tr></table>
</ItemTemplate>
</asp:DataList>
</td>
</tr>
</table>
</div>
<script type="text/javascript">
var speed=20
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
function IMG1_onclick() {
}
</script>
<div id="demo" style="overflow: hidden; width:636px; color: #ffffff; height: 90px;">
<table border="0" cellpadding="0" cellspacing="0" class="line2" style="margin-top: 5px; width:612px;">
<tr>
<td style="height:2px">
</td>
</tr>
<tr>
<td id="demo2" style="height: 90px" valign="middle" >
</td>
<td id="demo1" align="center" style="height: 90px" valign="middle">
<asp:DataList ID="DataList3" runat="server" RepeatDirection="Horizontal" RepeatColumns="8" Width="620px">
<ItemTemplate>
<table><tr><td style="width:145px" valign="middle" >
<a href='<%#Eval("imgUrl") %>'>
<img height="91px" width="140" src='<%#Eval("imgUrl") %>' style="border-style: none" /></a>
</td></tr></table>
</ItemTemplate>
</asp:DataList>
</td>
</tr>
</table>
</div>
<script type="text/javascript">
var speed=20
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
function IMG1_onclick() {
}
</script>
一只站在树上的鸟儿,从来不会害怕树枝会断裂,因为它相信的不是树枝,而是它自己的翅膀。与其每天担心未来,不如努力做好现在。