动态广告管理程序制作例子
敬业的IT人
互联网
佚名
2008-4-14 17:09:36
By Wayne Berry
This Issue
Many sites that are content specific depend>
Once you have referred to a dynamic Active Server page with the static page, you need to build an Active
Server page to return an image, in this case a banner. Example 2 shows the code to use for servebanner.asp
which is called in Example 1.
Example 2 : ServeBanner.asp Source
<%
Response.Redirect("http://www.myserver.com/banner.gif")
%>
These two pages combined will allow you to display to the user a banner as if you referred directly to the
banner image instead of an Active Server page. In order to do banner rotation all you have to do is expand
Example 2 so different images come up every time ServeBanner.asp is called.
Adding the Element of Rotation.
With this technique the dynamic aspect of the banner rotation is controlled within the Active Server page
that the IMG tag is referring to. In order to randomly rotate the banners you will need to change
ServerBanner.asp to choose a different banner each time that it is called. Example 3 shows how to do this.
Example 3 : Rotating Banners
<%
Dim Array(2)
' Initialize the VBScript Random
' Number Generator
Randomize
Array(1)="http://www.myserver.com/banner1.gif"
Array(2)="http://www.myserver.com/banner2.gif"
upperbound=UBound(Array)
lowerbound=1
lRandom = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
This Issue
Many sites that are content specific depend>
Once you have referred to a dynamic Active Server page with the static page, you need to build an Active
Server page to return an image, in this case a banner. Example 2 shows the code to use for servebanner.asp
which is called in Example 1.
Example 2 : ServeBanner.asp Source
<%
Response.Redirect("http://www.myserver.com/banner.gif")
%>
These two pages combined will allow you to display to the user a banner as if you referred directly to the
banner image instead of an Active Server page. In order to do banner rotation all you have to do is expand
Example 2 so different images come up every time ServeBanner.asp is called.
Adding the Element of Rotation.
With this technique the dynamic aspect of the banner rotation is controlled within the Active Server page
that the IMG tag is referring to. In order to randomly rotate the banners you will need to change
ServerBanner.asp to choose a different banner each time that it is called. Example 3 shows how to do this.
Example 3 : Rotating Banners
<%
Dim Array(2)
' Initialize the VBScript Random
' Number Generator
Randomize
Array(1)="http://www.myserver.com/banner1.gif"
Array(2)="http://www.myserver.com/banner2.gif"
upperbound=UBound(Array)
lowerbound=1
lRandom = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
- 最新文章
- 深入研究“用ASP上载文件”(一)[04-14]
- 深入研究“用ASP上载文件”(二)[04-14]
- 一个投票系统的源程序(coveryourasp.com)[04-14]
- 一 些 ASP 小 源 程 序[04-14]
- 用ASP制作个性化的调查板(附源程序)[04-14]
- 一些源程序 - 获得文件大小和字符串处理[04-14]
- 相关文章
- 动态按钮生成器(上)[04-14]
- 动态按钮生成器(下)[04-14]
- 建立动态下拉式选单(三阶层)[04-14]
- 在ASP中改善动态分页的性能[04-14]
- 三层动态下拉菜单的例子[04-14]
- 动态显示图片的函数(显示广告条)[04-14]
