The GetAdvertisement method retrieves the next advertisement from the Rotator Schedule file. Each time the script is run, such as when a user opens or refreshes a page, the method retrieves the next scheduled advertisement.
AdRotator.GetAdvertisement( rotationSchedulePath )
Returns HTML that displays the advertisement in the current page.
The following example uses all the properties to display a different advertisement each time a user views the Web page.
--- AdRot.asp ---
<%
Set ad = Server.CreateObject("MSWC.AdRotator")
ad.Clickable = True
ad.Border = 1
ad.TargetFrame = "target=_TOP"
Response.Write ad.GetAdvertisement("adrot.txt")
%>
The following HTML is generated by the GetAdvertisement method and is added to the page's output, displaying the next advertisement in the Rotator Schedule file.
<A HREF="adredir.asp?url=http://www.microsoft.com/windows2000/guide/professional/overview/&image=http://www.microsoft.com/library/homepage/images/init_win2k.gif" TARGET="target=_TOP"><IMG SRC="http://www.microsoft.com/library/homepage/images/init_win2k.gif" ALT="Introducing Microsoft Windows XP Professional!" WIDTH=340 HEIGHT=100 BORDER=1></A>