ASP AdRotator
Component
ASP AdRotator Component
Whenever a user enters the website or refreshes the page, the ASP AdRotator component creates an AdRotator object to display a different image. The information about the images is contained in a text file.
Note: AdRotator does not work in Internet Information Server 7 (IIS7).
Syntax
ASP AdRotator Example
Suppose we have a file named "ads.txt" as shown below:
In the above text file, the lines below the model specify the name of the image to be displayed, the hyperlink address, the alternate text for the image, and the display probability per hundred clicks.
The first line of the above text file specifies the action to be taken when a visitor clicks on the image. The redirect page (banners.asp) will receive a query string with the redirect URL.
Tip: To specify the height, width, and border of the image, you can insert the following code below the REDIRECT:
The "banners.asp" file is shown below:
Example
That's all there is to it!
ASP AdRotator Properties
Property | Description | Example |
---|---|---|
Border | Specifies the size of the border around the advertisement. | <% <br>set adrot=Server.CreateObject("MSWC.AdRotator") <br>adrot.Border="2" <br>Response.Write(adrot.GetAdvertisement("ads.txt")) <br>%> |
Clickable | Specifies whether the advertisement itself is a hyperlink. | <% <br>set adrot=Server.CreateObject("MSWC.AdRotator") <br>adrot.Clickable=false <br>Response.Write(adrot.GetAdvertisement("ads.txt")) <br>%> |
TargetFrame | The name of the frame where the advertisement is displayed. | <% <br>set adrot=Server.CreateObject("MSWC.AdRotator") <br>adrot.TargetFrame="target='_blank'" <br>Response.Write(adrot.GetAdvertisement("ads.txt")) <br>%> |
ASP AdRotator Methods
Method | Description | Example |
---|---|---|
GetAdvertisement | Returns the HTML to display the advertisement on the page. | <% <br>set adrot=Server.CreateObject("MSWC.AdRotator") <br>Response.Write(adrot.GetAdvertisement("ads.txt")) <br>%> |