效果如下图:
基本语法
<marquee> ... </marquee>
移动属性的设置 ,这种移动不仅仅局限于文字,也可以应用于图片,表格等等
方向
<direction=#> #=left, right ,up ,down <marquee direction=left>从右向左移!</marquee>
方式
<bihavior=#> #=scroll, slide, alternate <marquee behavior=scroll>一圈一圈绕着走!</marquee>
<marquee behavior=slide>只走一次就歇了!</marquee>
<marquee behavior=alternate>来回走</marquee>
循环
<loop=#> #=次数;若未指定则循环不止(infinite) <marquee loop=3 width=50% behavior=scroll>只走 3 趟</marquee> <P>
<marquee loop=3 width=50% behavior=slide>只走 3 趟</marquee>
<marquee loop=3 width=50% behavior=alternate>只走 3 趟!</marquee>
速度
<scrollamount=#> <marquee scrollamount=20>啦啦啦,我走得好快哟!</marquee>
延时
<scrolldelay=#> <marquee scrolldelay=500 scrollamount=100>啦啦啦,我走一步,停一停!</marquee>
外观(Layout)设置
对齐方式(Align)
<align=#> #=top, middle, bottom <font size=6>
<marquee align=# width=400>啦啦啦,我会移动耶!</marquee>
</font>
底色
<bgcolor=#> #=rrggbb 16 进制数码,或者是下列预定义色彩:
Black, Olive, Teal, Red, Blue, Maroon, Navy, Gray, Lime,
Fuchsia, White, Green, Purple, Silver, Yellow, Aqua <marquee bgcolor=aaaaee>颜色!</marquee>
面积
<height=# width=#> <marquee height=40 width=50% bgcolor=aaeeaa>面积!</marquee>
空白
(Margins)<hspace=# vspace=#>
<marquee hspace=20 vspace=20 width=150 bgcolor=ffaaaa align=middle>面积!</marquee>
方向
<direction=#> #=left, right ,up ,down <marquee direction=left>从右向左移!</marquee>
方式
<bihavior=#> #=scroll, slide, alternate <marquee behavior=scroll>一圈一圈绕着走!</marquee>
<marquee behavior=slide>只走一次就歇了!</marquee>
<marquee behavior=alternate>来回走</marquee>
循环
<loop=#> #=次数;若未指定则循环不止(infinite) <marquee loop=3 width=50% behavior=scroll>只走 3 趟</marquee> <P>
<marquee loop=3 width=50% behavior=slide>只走 3 趟</marquee>
<marquee loop=3 width=50% behavior=alternate>只走 3 趟!</marquee>
速度
<scrollamount=#> <marquee scrollamount=20>啦啦啦,我走得好快哟!</marquee>
延时
<scrolldelay=#> <marquee scrolldelay=500 scrollamount=100>啦啦啦,我走一步,停一停!</marquee>
外观(Layout)设置
对齐方式(Align)
<align=#> #=top, middle, bottom <font size=6>
<marquee align=# width=400>啦啦啦,我会移动耶!</marquee>
</font>
底色
<bgcolor=#> #=rrggbb 16 进制数码,或者是下列预定义色彩:
Black, Olive, Teal, Red, Blue, Maroon, Navy, Gray, Lime,
Fuchsia, White, Green, Purple, Silver, Yellow, Aqua <marquee bgcolor=aaaaee>颜色!</marquee>
面积
<height=# width=#> <marquee height=40 width=50% bgcolor=aaeeaa>面积!</marquee>
空白
(Margins)<hspace=# vspace=#>
<marquee hspace=20 vspace=20 width=150 bgcolor=ffaaaa align=middle>面积!</marquee>
====================
小技巧:
当鼠标放在上面时就停止滚动,移开时又继续滚动?
------------------------------------
<marquee id="li" onmouseover="this.stop()"
onmouseout="this.start()">滚动内容</marquee>
===============
一个实例:
效果:(asp.net中滚动datagrid,并且前面加链接图片,当鼠标放在上面时就停止滚动,移开时又继续滚动)
实例代码:
<TD style="WIDTH: 230px" vAlign="middle" align="left" height="100">
<marquee style="WIDTH: 220px; HEIGHT: 80px" direction="up" scrolldelay="300" onmouseover="this.stop()"
onmouseout="this.start()">
<asp:datagrid id="dgGongGao" runat="server" Width="100%" Height="76px" BorderWidth="0px" ShowHeader="False"
AutoGenerateColumns="False" GridLines="None" PageSize="100">
<Columns>
<asp:TemplateColumn HeaderText="公告标题">
<ItemTemplate>
<a target = _blank href ='<%# DataBinder.Eval(Container, "DataItem.公告编号", "gonggao.aspx?id={0}") %>'>
<img src="images/right.gif" border="0"> </a>
<asp:HyperLink runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.标题") %>' NavigateUrl='<%# DataBinder.Eval(Container, "DataItem.公告编号", "gonggao.aspx?id={0}") %>' Target="_blank" ID="Hyperlink3">
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
</marquee>
<asp:hyperlink id="hlAllGongGao" runat="server" NavigateUrl="allgonggao.aspx" Target="_blank">全部公告>></asp:hyperlink>
</TD>