ASP Content Rotator Component (ASP 3.0)
ASP Content Rotator Component
ASP Content Rotator component는 방문자의 출입 또는 page의 refresh마다 다른 content를 표시하는 ContentRotator object를 생성한다.
Content Schedule File의 text file은 content strings에 대한 정보를 포함한다.
content strings는 HTML tags를 포함할 수 있고 따라서 HTML 이 표현할 수 있는 (text, images, colors, 또는 hyperlinks) content의 type을 표시할 수 있다.
Syntax
<% Set cr=Server.CreateObject("MSWC.ContentRotator") %> |
ASP Content Rotator Example
다음 example은 방문자가 웹 페이지를 볼 때마다 다른 content를 보여준다.
먼저, “textads.txt" text file을 생성하고, 그것을 ”text" subfolder에 위치 시킨다.
“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> |
각각의 content string의 시작에 #number이 있다. 이 number는 HTML content string의 상대적 weight를 나타내는 선택사항 parameter이다. 위의 text file에서, Content Rotator는 10번 중 3번을 첫 번째 와 두 번째 content string을 보여주고, 10번 중 4번을 세 번째 string을 보여줄 것이다.
그리고 ASP file을 생성하고, 다음 코드를 삽입한다.
<html> <body> <% set cr=server.createobject("MSWC.ContentRotator") response.write(cr.ChooseContent("text/textads.txt")) %> </body> </html> |
ASP Content Rotator Component's Methods
Method |
Description |
Example |
ChooseContent |
content 를 얻고 표시한다. |
<% dim cr Set cr=Server.CreateObject("MSWC.ContentRotator") response.write(cr.ChooseContent("text/textads.txt")) %>
output |
GetAllContent |
text file안의 content strings 의 모두를 얻고 표시한다. |
<% dim cr Set cr=Server.CreateObject("MSWC.ContentRotator") response.write(cr.GetAllContent("text/textads.txt")) %>
Output:
This is a great day!!
|
원본 사이트 : http://www.w3schools.com/asp/asp_contentrotator.asp
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Comment Write
Comment List