在ASP.NET中使用marquee控件,怎么让图片横着滚动。

来源:百度知道 编辑:UC知道 时间:2024/05/21 17:36:10
<marquee direction="left" width="430" scrollamount="3" onmouseover="this.stop()" onmouseout="this.start()" style="height: 100px"><asp:DataList id="DataList1" OnItemCommand="DataList1_ItemCommand" Height="100px" Width="427px" runat="server" RepeatColumns="1" RepeatDirection="Horizontal"><ItemTemplate>
<table><tr><td style="font-size:9pt">
<asp:Image ID="Image1" runat="server" Height="100px" Width="135px" ImageUrl="~/GundongImg/0245.jpg"/>

</td></tr></table>
</ItemTemplate>
</asp:DataList></marquee>
这是我写的。
在设计界面显示的是竖着的5张图片。

http://hi.baidu.com/moonnight366/blog/item/ff5b7b2ab663863b5343c12a.html

参考

marquee,图片连续滚动,不留空白2007-11-07 01:15 P.M.在网上有类似的方法,原来一直认为必须是asp的程序,而在asp.net里用不了,结果在vs2005里照着改一下居然好用,下面是我按照我要的效果做的方法:

(图片是从数据库中取路径,page_load()的时候赋的url,是一个长图片从右至左不间断的滚动)

<div id=maq style=overflow:hidden;height:90px;width:700px;>
<table cellpadding=0 cellspace=0 border=0 width=100%><tr width=100%>
<td id=mtext valign=top><asp:Image ID="Image1" runat="server" /></td>
<td valign=top id=m0></td></tr></table>
</div>

<script>
var speed=40 //调整滚动速度
m0.innerHTML=mtext.innerHTML
function Marquee(){
if(m0.offsetWidth-maq.scrollLeft<=0)
maq.scrollLeft-=mtext.offsetWidth
else{
maq.scroll