The Ad Rotator component creates an Ad Rotator object that
displays a different advertisement image each time a user opens
or refreshes the page. A text file includes information about
the images.
To record how many users clicking on each advertisement, or to
create links of the images, redirect the users to a "Redirection
File".
The "Redirection File" is an optional file that implements
redirection, and enables the Ad Rotator to record each click on
each advertisement. Each jump to an advertiser's url will be
recorded in the server's activity log.
Syntax
<% set adrotator=server.createobject("MSWC.AdRotator")
adrotator.GetAdvertisement("sometextfile.txt") %>
Methods
Method Description
GetAdvertisement(text_file) Gets information about the
next advertisement in the text file,
and formats it as HTML
Properties
Property Description
Border Sets the size of the border around the advertisement
Clickable Specifies whether the advertisement is a hyperlink
TargetFrame Name of the frame to display the advertisement
Examples
1. The AdRotator Component
This component displays a different advertisement each time a
user visits or refreshes the page.
Coding
<html>
<body>
<%
set adrotator=Server.CreateObject("MSWC.AdRotator")
adrotator.Border="2"
adrotator.Clickable=false
Response.Write(adrotator.GetAdvertisement("text/advertisements.txt"))
%>
<p>
NOTE: Because the images are changed randomly, and because this
page has only four images to choose from, sometimes the page
will display the same advertisement twice in a row.
</p>
<p>
<a href="text/advertisements.txt"><img border="0" src="../images/btn_view_text.gif"></a>
</p>
</body>
</html>
Output
NOTE: Because the images are changed randomly, and because this
page has only four images to choose from, sometimes the page
will display the same advertisement twice in a row.
View Text File
*
../banners/rd_htmlref.jpg
http://www.w3schools.com/html/html_reference.asp
Complete HTML 4.0 Reference
20
../banners/w3schools.gif
http://www.w3schools.com
Web Tutorials from W3Schools
20
../banners/w3scripts.gif
http://www.w3scripts.com
Lots of Scripts and Examples
20
../banners/wroxxmlbanner.gif
http://www.w3schools.com/xml/xml_books.asp
XML Books
20
2. The AdRotator Component 2
This component displays a different advertisement each time a
user visits or refreshes the page. In addition, the images are
hyperlinks.
Coding
<%
url=Request.QueryString("url")
If url<>"" then Response.Redirect(url)
%>
<html>
<body>
<%
set adrotator=Server.CreateObject("MSWC.AdRotator")
adrotator.TargetFrame="target='_blank'"
response.write(adrotator.GetAdvertisement("text/advertisements2.txt"))
%>
<p>
NOTE: Because the images are changed randomly, and because this
page has only four images to choose from, sometimes the page
will display the same advertisement twice in a row.
</p>
<p>
<a href="text/advertisements2.txt"><img border="0" src="../images/btn_view_text.gif"></a>
</p>
</body>
</html>
Output
NOTE: Because the images are changed randomly, and because this
page has only four images to choose from, sometimes the page
will display the same advertisement twice in a row.
View Text Files
REDIRECT demo_adrotator2.asp
*
../banners/rd_htmlref.jpg
http://www.w3schools.com/html/html_reference.asp
Complete HTML 4.0 Reference
20
../banners/w3schools.gif
http://www.w3schools.com
Web Tutorials from W3Schools
20 ../banners/w3scripts.gif
http://www.w3scripts.com
Lots of Scripts and Examples
20 ../banners/wroxxmlbanner.gif
http://www.w3schools.com/xml/xml_books.asp
XML Books
20