AdRotator控件的使用

来源:岁月联盟 编辑:zhu 时间:2005-06-17
下面的示例说明可以如何使用AdRotator控件在页上动态显示旋转的广告。



aspx文件:
<%@ Page Language="C#"%>
<html>
<head>
</head>
<body>
<center>
<form action="intro5.aspx" method="post" runat="server">
<asp:AdRotator AdvertisementFile="ads.xml" BorderColor="black" BorderWidth=1 runat="server"/>
</form>
</center>
</body>
</html>



ads.xml文件:
<Advertisements>
   <Ad>      <ImageUrl>/quickstart/aspplus/images/banner1.gif</ImageUrl>
      <NavigateUrl>http://www.microsoft.com</NavigateUrl>
      <AlternateText>Alt Text</AlternateText>
      <Keyword>Computers</Keyword>
      <Impressions>80</Impressions>
   </Ad>
   <Ad>
      <ImageUrl>/quickstart/aspplus/images/banner2.gif</ImageUrl>
      <NavigateUrl>http://www.microsoft.com</NavigateUrl>
      <AlternateText>Alt Text</AlternateText>
      <Keyword>Computers</Keyword>
      <Impressions>80</Impressions>
   </Ad>
   <Ad>
      <ImageUrl>/quickstart/aspplus/images/banner3.gif</ImageUrl>
      <NavigateUrl>http://www.microsoft.com</NavigateUrl>
      <AlternateText>Alt Text</AlternateText>
      <Keyword>Computers</Keyword>
      <Impressions>80</Impressions>
   </Ad>
</Advertisements>