<%
@ Page Language
=
"
C#
"
AutoEventWireup
=
"
true
"
CodeFile
=
"
Default.aspx.cs
"
Inherits
=
"
_Default
"
%>
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< html xmlns ="http://www.w3.org/1999/xhtml" >
< head runat ="server" >
< title > 广告轮播器的使用 </ title >
< meta http-equiv ="Content-Type" content ="text/html;charset=gb2312" />
< meta http-equiv ="refresh" content ="5; url=main.htm" />
</ head >
< body >
< form id ="form1" runat ="server" >
< div align ="center" >
< table align ="center" >
< tr >
< td >
< asp:Calendar ID ="Calendar1" runat ="server" TitleStyle-BackColor ="#aaaadd" DayHeaderStyle-BackColor ="#ffffc0"
NextPrevFormat ="CustomText" PrevMonthText ="<Img src=image/PRE.GIF border=0>" NextMonthText ="<Img src=image/next.gif border=0>"
SelectionMode ="None" ></ asp:Calendar >
</ td >
</ tr >
< tr >
< td >
< hr />
< p align ="center" >
< strong > LOADING </ strong ></ p >
< asp:AdRotator ID ="adrot1" BorderWidth ="1" runat ="server" AdvertisementFile ="~/Adrot_XMLFile.xml" />
</ td >
</ tr >
</ table >
</ div >
</ form >
</ body >
</ html >
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< html xmlns ="http://www.w3.org/1999/xhtml" >
< head runat ="server" >
< title > 广告轮播器的使用 </ title >
< meta http-equiv ="Content-Type" content ="text/html;charset=gb2312" />
< meta http-equiv ="refresh" content ="5; url=main.htm" />
</ head >
< body >
< form id ="form1" runat ="server" >
< div align ="center" >
< table align ="center" >
< tr >
< td >
< asp:Calendar ID ="Calendar1" runat ="server" TitleStyle-BackColor ="#aaaadd" DayHeaderStyle-BackColor ="#ffffc0"
NextPrevFormat ="CustomText" PrevMonthText ="<Img src=image/PRE.GIF border=0>" NextMonthText ="<Img src=image/next.gif border=0>"
SelectionMode ="None" ></ asp:Calendar >
</ td >
</ tr >
< tr >
< td >
< hr />
< p align ="center" >
< strong > LOADING </ strong ></ p >
< asp:AdRotator ID ="adrot1" BorderWidth ="1" runat ="server" AdvertisementFile ="~/Adrot_XMLFile.xml" />
</ td >
</ tr >
</ table >
</ div >
</ form >
</ body >
</ html >
对应的XML文件Adrot_SMLFile.xml:
<?
xml version="1.0" encoding="utf-8"
?>
<!-- 节点Advertisements-Ad
属性
ImageUrl-图像文件的绝对或相对地址
NavigateUrl-当图像被点击时,可访问相应的网页
AlternateText-当鼠标移动观察家图片上时,将显示提示信息
Keyword-指定广告条的分类,我们可以利用此属性对广告条进行分类
Impressions-指示广告的可能显示频率的数值.在XML文件中所有的impression值的总和不能超过2,048,000,000-1 -->
< Advertisements >
< Ad >
< ImageUrl > ./image/hp1.gif </ ImageUrl >
< NavigateUrl > http://www.baidu.com </ NavigateUrl >
< AlternateText > 广告轮播器的练习 </ AlternateText >
< Keyword > Computers </ Keyword >
< Impressions > 4 </ Impressions >
</ Ad >
< Ad >
< ImageUrl > ./image/hp2.gif </ ImageUrl >
< NavigateUrl > http://www.baidu.com </ NavigateUrl >
< AlternateText > 广告轮播器的练习 </ AlternateText >
< Keyword > Computers </ Keyword >
< Impressions > 3 </ Impressions >
</ Ad >
< Ad >
< ImageUrl > ./image/hp3.gif </ ImageUrl >
< NavigateUrl > http://www.baidu.com </ NavigateUrl >
< AlternateText > 广告轮播器的练习 </ AlternateText >
< Keyword > Computers </ Keyword >
< Impressions > 2 </ Impressions >
</ Ad >
< Ad >
< ImageUrl > ./image/hp4.gif </ ImageUrl >
< NavigateUrl > http://www.baidu.com </ NavigateUrl >
< AlternateText > 广告轮播器的练习 </ AlternateText >
< Keyword > Computers </ Keyword >
< Impressions > 1 </ Impressions >
</ Ad >
</ Advertisements >
<!-- 节点Advertisements-Ad
属性
ImageUrl-图像文件的绝对或相对地址
NavigateUrl-当图像被点击时,可访问相应的网页
AlternateText-当鼠标移动观察家图片上时,将显示提示信息
Keyword-指定广告条的分类,我们可以利用此属性对广告条进行分类
Impressions-指示广告的可能显示频率的数值.在XML文件中所有的impression值的总和不能超过2,048,000,000-1 -->
< Advertisements >
< Ad >
< ImageUrl > ./image/hp1.gif </ ImageUrl >
< NavigateUrl > http://www.baidu.com </ NavigateUrl >
< AlternateText > 广告轮播器的练习 </ AlternateText >
< Keyword > Computers </ Keyword >
< Impressions > 4 </ Impressions >
</ Ad >
< Ad >
< ImageUrl > ./image/hp2.gif </ ImageUrl >
< NavigateUrl > http://www.baidu.com </ NavigateUrl >
< AlternateText > 广告轮播器的练习 </ AlternateText >
< Keyword > Computers </ Keyword >
< Impressions > 3 </ Impressions >
</ Ad >
< Ad >
< ImageUrl > ./image/hp3.gif </ ImageUrl >
< NavigateUrl > http://www.baidu.com </ NavigateUrl >
< AlternateText > 广告轮播器的练习 </ AlternateText >
< Keyword > Computers </ Keyword >
< Impressions > 2 </ Impressions >
</ Ad >
< Ad >
< ImageUrl > ./image/hp4.gif </ ImageUrl >
< NavigateUrl > http://www.baidu.com </ NavigateUrl >
< AlternateText > 广告轮播器的练习 </ AlternateText >
< Keyword > Computers </ Keyword >
< Impressions > 1 </ Impressions >
</ Ad >
</ Advertisements >
源码:一个简单的广告轮播器