ASP AdRotator
ASP AdRotator Component
The ASP AdRotator component creates an AdRotator object to display a different image every time the user enters the website or refreshes the page. Information about the image is contained in a text file.
Note: AdRotator does not work in Internet Information Server 7 (IIS7).
Syntax
set adrotator=server.createobject("MSWC.AdRotator")
adrotator.GetAdvertisement("textfile.txt")
%>
ASP AdRotator Example
Suppose we have a file named "ads.txt" as shown below:
*
w3s.gif
http://www.w3cschool.cc
Free Tutorials from W3CSchool
50
xmlspy.gif
http://www.altova.com
XML Editor from Altova
50
In the above text file, the line below the model specifies the name, super Link address, image alt text, and appearance rate per 100 clicks.
The first line of the above text file specifies the action to take when a visitor clicks on the image. The redirect page (banners.asp) will receive a query string with the redirect URL.
Tips: If you need to specify the height, width and border of the image, you can insert the following code below REDIRECT:
WIDTH 468
HEIGHT 60
BORDER 0
*
w3s.gif
...
"banners.asp" The file looks like this:
Instance
<% url=Request.QueryString("url") If url<>"" then Response.Redirect(url) %> <!DOCTYPE html> <html> <body> <% set adrotator=Server.CreateObject("MSWC.AdRotator") response.write(adrotator.GetAdvertisement("textfile.txt")) %> </body> </html>
Run Instance»
Click the "Run Instance" button to view the online instance
Okay, that’s all!
ASP AdRotator Properties
Properties | Description | Instance |
---|---|---|
Border | Specifies the size of the border surrounding the ad. | <% set adrot=Server.CreateObject("MSWC.AdRotator") adrot.Border="2" Response.Write(adrot.GetAdvertisement("ads.txt ")) %> |
Clickable | Specifies whether the advertisement itself is a hyperlink. | <% set adrot=Server.CreateObject("MSWC.AdRotator") adrot.Clickable=false Response.Write(adrot.GetAdvertisement("ads.txt") ) %> |
TargetFrame | The name of the frame that displays the advertisement. | <% set adrot=Server.CreateObject("MSWC.AdRotator") adrot.TargetFrame="target='_blank'" Response.Write(adrot.GetAdvertisement( "ads.txt")) %> |
ASP AdRotator Method
Description | Instance | |
---|---|---|
Return the HTML that displays the advertisement in the page. | <% | set adrot=Server.CreateObject("MSWC.AdRotator") Response.Write(adrot.GetAdvertisement("ads.txt")) %> |