ASP.NET中利用DataList实现图片无缝滚动
2014-08-29来源:

<asp:ImageButton ID="imgbtnInfo" runat="server" ImageUrl='<%#Eval("Spic") %>'

OnClick="imgbtnInfo_Click"CommandArgument='<%#Eval("ID") %>' />

</td>

</tr>

<tr>

<td align="center">

<asp:LinkButton ID="lkbtnInfo" CommandArgument='<%#Eval("ID") %>' runat="server"

OnClick="lkbtnInfo_Click" CssClass="bb" Text='<%#Eval("Type") %>'>

</asp:LinkButton>

</td>

</tr>

</table>

</ItemTemplate>

</asp:DataList>

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="SelectInfo"

TypeName="HotelDAL.KeFangServices"></asp:ObjectDataSource>

</td>

<%-- 这一步很重要 --%>

<td id="demo2" align="center" valign="bottom">

</td>

</tr>

</table>

</div>

<script>

//滚动的速度,数值越大速度越慢

var speed = 20

demo2.innerHTML = demo1.innerHTML

//从右至左

function Marquee() {

if (demo1.offsetWidth - demo.scrollLeft <= 0)

demo.scrollLeft = 0

else

demo.scrollLeft++

}

var MyMar = setInterval(Marquee, speed)

demo.onmouseover = function () { clearInterval(MyMar) }

demo.onmouseout = function () { MyMar = setInterval(Marquee, speed) }

</script>

更多信息请查看IT技术专栏

推荐信息
Baidu
map