敬业的IT人 >> 网站建设 >> Web编程 >> Asp >> 动态广告管理程序制作例子

动态广告管理程序制作例子

敬业的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)
粤ICP备06119539号
Copyright CiscoSky.Org,Some Rights Reserved.
Email:me1228#tom.com