WebForm的asp:AdRotator控件应用

来源:互联网 发布:超a鞋淘宝 编辑:程序博客网 时间:2024/06/06 18:58

富控件
asp:AdRotator:从一个外部的XML调度文件中随机选择横幅图片

XML文件:

<?xml version="1.0" encoding="utf-8" ?><Advertisements>  <Ad>    <ImageUrl>Images/search-16.gif</ImageUrl>    <NavigateUrl>http://www.apress.com</NavigateUrl>    <AlternateText>Apress - The Author's Press</AlternateText>    <Impressions>20</Impressions>    <Keyword>books</Keyword>  </Ad>  <Ad>    <ImageUrl>Images/orderedList0.png</ImageUrl>    <NavigateUrl>http://www.microsoft.com/events/teched2008</NavigateUrl>    <AlternateText>TechEd from Microsoft</AlternateText>    <Impressions>20</Impressions>    <Keyword>java</Keyword>  </Ad>  <Ad>    <ImageUrl>Images/orderedList1.png</ImageUrl>    <NavigateUrl>http://www.microsoft.com/events/teched2008</NavigateUrl>    <AlternateText>TechEd from Microsoft</AlternateText>    <Impressions>20</Impressions>    <Keyword>java</Keyword>  </Ad>  <Ad>    <ImageUrl>Images/orderedList2.png</ImageUrl>    <NavigateUrl>http://www.microsoft.com/events/teched2008</NavigateUrl>    <AlternateText>TechEd from Microsoft</AlternateText>    <Impressions>20</Impressions>    <Keyword>java</Keyword>  </Ad>  <Ad>    <ImageUrl>Images/orderedList3.png</ImageUrl>    <NavigateUrl>http://www.microsoft.com/events/teched2008</NavigateUrl>    <AlternateText>TechEd from Microsoft</AlternateText>    <Impressions>20</Impressions>    <Keyword>java</Keyword>  </Ad>  <Ad>    <ImageUrl>Images/orderedList4.png</ImageUrl>    <NavigateUrl>http://www.microsoft.com/events/teched2008</NavigateUrl>    <AlternateText>TechEd from Microsoft</AlternateText>    <Impressions>20</Impressions>    <Keyword>java</Keyword>  </Ad></Advertisements>

客户端引入Asp:Adrotator控件

 <asp:AdRotator runat="server" AdvertisementFile="~/Ads.xml" Target="_blank" />

案例图无:可添加几个图片自行测试,每次刷新页面都会随机选择图片

0 0
原创粉丝点击