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>
来源:https://www.cnblogs.com/rhythmK/archive/2009/05/27/1490703.html
标签