ASP AdRotator Komponenti

Tasi

Tasi na yaranci ko AdRotator
Tasi: Kowakowa kai a dake a bishilin ko a yanci ko asp AdRotator komponenta, wanda ake cire birki na gaba na da yanci kowane.
AdRotator - Likin birki
Tasi: Kowakowa kai a dake a bishilin ko a yanci ko asp AdRotator komponenta, wanda ake cire birki na gaba na da yanci kowane. Baki na birki ita ce liki.

ASP AdRotator Komponenti

Kowakowa kai a dake a bishilin ko a yanci ko asp AdRotator komponenta, wanda ake cire abin da yanci don nuna birki na gaba.

Yanmu:

<%
set adrotator=server.createobject("MSWC.AdRotator")
adrotator.GetAdvertisement("textfile.txt")
%>

Tasi

A dake a bishilin "banners.asp". Ta bai da:

<html>
<body>
<%
set adrotator=Server.CreateObject("MSWC.AdRotator")
response.write(adrotator.GetAdvertisement("ads.txt"))
%>
</body>
</html>

文件 "ads.txt" 类似这样:

*
codew3c.gif
http://www.codew3c.com/
访问 CodeW3C.com
80
microsoft.gif
http://www.microsoft.com/
访问 Microsoft
20  

"ads.txt" 文件中星号下面的代码定义了如何显示这些图像,链接地址,图像的替换文本,在每百次点击中的显示几率。我们可以看到,CodeW3C.com 图片的显示几率是 80%,而 Microsoft 图片的显示几率是 20%。

注释:为了使这些链接在用户点击时可以正常工作,我们需要对文件 "ads.txt" 进行一点点小小的修改:

REDIRECT banners.asp
*
codew3c.gif
http://www.codew3c.com/
访问 CodeW3C.com
80
microsoft.gif
http://www.microsoft.com/
访问 Microsoft
20

转向页面会接收到名为 url 的变量的查询字符串,其中含有供转向的 URL。

注释:如需规定图像的高度、宽度和边框,我们可以在 REDIRECT 下面插入这些代码:

REDIRECT banners.asp
WIDTH 468 
HEIGHT 60 
BORDER 0 
*
codew3c.gif
...
...

最后要做的是把这些代码加入文件"banners.asp"中:

<%
url=Request.QueryString("url")
If url<>"" then Response.Redirect(url)
%>
<html>
<body>
<%
set adrotator=Server.CreateObject("MSWC.AdRotator")
response.write(adrotator.GetAdvertisement("textfile.txt"))
%>
</body>
</html>

好了,这就是全部的内容!

组件 AdRotator 的属性

属性 Border

规定围绕广告的边框的尺寸。

<%
set adrot=Server.CreateObject("MSWC.AdRotator")
adrot.Border="2"
Response.Write(adrot.GetAdvertisement("ads.txt"))
%>

属性 Clickable

规定广告本身是否是超级链接。

<%
set adrot=Server.CreateObject("MSWC.AdRotator")
adrot.Clickable=false
Response.Write(adrot.GetAdvertisement("ads.txt"))
%>

属性 TargetFrame

显示广告的框架名称。

<%
set adrot=Server.CreateObject("MSWC.AdRotator")
adrot.TargetFrame="target='_blank'"
Response.Write(adrot.GetAdvertisement("ads.txt"))
%>

组件 AdRotator 的方法

方法 GetAdvertisement

Return HTML that displays ads on the page.

<%
set adrot=Server.CreateObject("MSWC.AdRotator")
Response.Write(adrot.GetAdvertisement("ads.txt"))
%>