可能有很多初学者朋友和我一样(特别是学过asp的),都有这么一个困惑,asp.net(C#)里面怎么做滚动新闻?
先些个简单的例子如下,也给自己留个档。
先些个简单的例子如下,也给自己留个档。
<
marquee
onmouseover
="javascript:this.stop();"
onmouseout
="javascript:this.start();"
scrollamount
="1"
direction ="up" style ="WIDTH: 401px; HEIGHT: 132px" >
< asp:DataGrid id =dgNews runat ="server" Height ="132px" Width ="392px" BorderStyle ="None" ShowHeader ="False" GridLines ="None" BorderColor ="White" AutoGenerateColumns =False DataSource ="<%# dvNews %>" >
< Columns >
< asp:BoundColumn DataField ="PostID" DataFormatString ="<img src=images/arrow.gif>" >
< ItemStyle Width ="10px" >
</ ItemStyle >
</ asp:BoundColumn >
< asp:HyperLinkColumn Target ="_blank" DataNavigateUrlField ="PostID" DataNavigateUrlFormatString ="ShowNews.aspx?PostID={0}" DataTextField ="Title" SortExpression ="PostDate" ></ asp:HyperLinkColumn >
</ Columns >
</ asp:DataGrid >
</ marquee >
direction ="up" style ="WIDTH: 401px; HEIGHT: 132px" >
< asp:DataGrid id =dgNews runat ="server" Height ="132px" Width ="392px" BorderStyle ="None" ShowHeader ="False" GridLines ="None" BorderColor ="White" AutoGenerateColumns =False DataSource ="<%# dvNews %>" >
< Columns >
< asp:BoundColumn DataField ="PostID" DataFormatString ="<img src=images/arrow.gif>" >
< ItemStyle Width ="10px" >
</ ItemStyle >
</ asp:BoundColumn >
< asp:HyperLinkColumn Target ="_blank" DataNavigateUrlField ="PostID" DataNavigateUrlFormatString ="ShowNews.aspx?PostID={0}" DataTextField ="Title" SortExpression ="PostDate" ></ asp:HyperLinkColumn >
</ Columns >
</ asp:DataGrid >
</ marquee >
其中 dvNews 是我们从数据库取出来的数据。
本文转自浪子博客园博客,原文链接:http://www.cnblogs.com/walkingboy/archive/2005/04/12/136010.html,如需转载请自行联系原作者