### GetAdvertisement

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.

###### Syntax

AdRotator.GetAdvertisement( rotationSchedulePath )

###### Parameters

rotationSchedulePath
  Specifies the location of the Rotator Schedule file relative to the virtual directory. For example, if the physical path was C:\Inetpub\Wwwroot\Ads\Adrot.txt (where Wwwroot is the "/" virtual directory) you would specify the path \Ads\Adrot.txt.

###### Return Values

Returns HTML that displays the advertisement in the current page.

###### Example

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>

© 1997-2001 Microsoft Corporation. All rights reserved.