ASP AdRotator components used in basic teaching

Source: Internet
Author: User

ASP AdRotator Components

Whenever a user enters a Web site or refreshes a page, the ASP AdRotator component creates a AdRotator object to display a different picture.

Grammar:

The following are the referenced contents:
<%
Set Adrotator=server.createobject ("MSWC. AdRotator ")
AdRotator. GetAdvertisement ("Textfile.txt")
%>

Instance

Suppose we have a file named "Banners.asp". It is similar to this:

The following are the referenced contents:
<body%>
<%
Set Adrotator=server.createobject ("MSWC. AdRotator ")
Response.Write (AdRotator. GetAdvertisement ("Ads.txt"))
%>
</body%>

The file "Ads.txt" resembles this:

The following are the referenced contents:
*
Webjxcom.gif
http://www.webjx.com/
Visit webjx.com
80
Microsoft.gif
http://www.microsoft.com/
Visit Microsoft
20

The code below the asterisk in the "ads.txt" file defines how to display these images, the link address, the alternate text of the image, and the realistic probability of each of the hundreds of clicks. As we can see, the probability of a w3school picture is 80%, and the Microsoft picture has a 20% chance to display it.

Note: To make these links work correctly when the user clicks, we need to make a little bit of change to the file "Ads.txt":

The following are the referenced contents:
REDIRECT banners.asp
*
Webjxcom.gif
http://www.webjx.com/
Visit webjx.com
80
Microsoft.gif
http://www.microsoft.com/
Visit Microsoft
20

The turn page receives a query string with a variable named URL that contains the URL to turn to.

Note: If you want to specify the height, width, and border of the image, we can insert the code below the redirect:

The following are the referenced contents:
REDIRECT banners.asp
WIDTH 468
HEIGHT 60
BORDER 0
*
Webjxcom.gif
...
...

The last thing to do is to add the code to the file "banners.asp":

The following are the referenced contents:

<%
url=request.querystring ("url")
If url<> "" then Response.Redirect (URL)
%>
<body>
<%
Set Adrotator=server.createobject ("MSWC. AdRotator ")
Response.Write (AdRotator. GetAdvertisement ("Textfile.txt"))
%>
</body>



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.