ASP Content Rotator Component (ASP 3.0)
ASP Content Rotator Component
The ASP Content Rotator component creates a ContentRotator object that displays a
different content string each time a visitor enters or refreshes a page.
A
text file, called the Content Schedule File, includes the information about the content strings.
The content strings can contain HTML tags so you can display any type
of content that HTML can represent: text, images, colors, or hyperlinks.
Syntax
<%
Set cr=Server.CreateObject("MSWC.ContentRotator")
%> |
ASP Content Rotator Example
The following example displays a different content each time a visitor views
the Web page.
First, create a text file named "textads.txt" and place it in a subfolder called
"text".
"textads.txt":
%% #3
<h2>This is a great day!!</h2>
%% #3
<img src="smiley.gif">
%% #4
<a href="http://www.w3schools.com">Visit W3Schools.com</a> |
Notice the #number at the beginning of each content string. This number is
an optional parameter that indicates the relative weight of the HTML content
string. In the text file above, the Content Rotator will display the first and
second content
string three-tenth of the time, and the third string four-tenths of
the time.
Then, create an ASP file, and insert the following code:
Example
<html>
<body>
<%
set cr=server.createobject("MSWC.ContentRotator")
response.write(cr.ChooseContent("text/textads.txt"))
%>
</body>
</html>
|
Show example »
|
ASP Content Rotator Component's Methods
| Method |
Description |
Example |
| ChooseContent |
Gets and displays a content string |
<%
dim cr
Set cr=Server.CreateObject("MSWC.ContentRotator")
response.write(cr.ChooseContent("text/textads.txt"))
%>Output:
 |
| GetAllContent |
Retrieves and displays all of the content strings in the text file |
<%
dim cr
Set cr=Server.CreateObject("MSWC.ContentRotator")
response.write(cr.GetAllContent("text/textads.txt"))
%>
Output:
This is a great day!!

Visit W3Schools.com |
Make your web applications look like a million bucks
|
|
Most web applications today use boring methods to present data to their viewers using grids or simple HTML tables. FusionCharts induces "life" into the web applications by converting monotonous data into lively charts, gauges & maps.
FusionCharts works with all technologies like ASP, ASP.NET, PHP, ColdFusion, Ruby on Rails, JSP, HTML pages etc.
and connects to any database to render animated & interactive charts. It takes less than 15 minutes and no expertise
whatsoever to build your first chart and just a glance of it to captivate your audience. This fact is endorsed by our
12,000 customers and 150,000 users which include a majority of the Fortune 500 companies.
And yeah, your applications could look like a million bucks by spending just $69.
So go ahead, download your
copy of FusionCharts and start "wow-ing" your customers now!
|
 |
W3Schools' Online Certification Program
The perfect solution for professionals who need to balance work, family, and career building.
More than 4000 certificates already issued!
|
The HTML Certificate documents your knowledge of HTML, XHTML, and CSS.
The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.
The XML Certificate documents your knowledge of XML, XML DOM and XSLT.
The ASP Certificate documents your knowledge of ASP, SQL, and ADO.
The PHP Certificate documents your knowledge of PHP and SQL (MySQL).
|