当前位置: 移动技术网 > IT编程>开发语言>.net > 动态广告管理程序制作例子

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

2018年10月22日  | 移动技术网IT编程  | 我要评论

痛风安十五味乳鹏丸,drag,德州学院音乐系

by wayne berry
this issue
many sites that are content specific depend on banner advertisement for revenue. such is the case for 15
seconds. a banner is displayed at the top of the page for every page viewed. clients usually buy a set
number of banner impressions and these impressions are rotated amongst all the clients over a period of
time. in order to do this there must be a dynamic quality to the banners. in other words, the banner to
display is not determined until that page is requested.
with an active server page this is an easy task. active server pages are dynamic and there are many
components that handle the task of banner rotation. a simple one comes free with the internet information
server, and more complicated rotation schedules can be done with site server and other third party
components. this article is not about how to implement these components within your active server pages,
since this is a fairly easy task.

this article will describe how to implement a banner rotation scenario where the pages served are static,
i.e. .htm, and do not have the flexibility to call components. the task is to dynamically serve banners
and statically serve pages. this is the opposite of the scenario for banner rotation components, which
statically serve banners and dynamically serve pages.

one trick
there is only one trick here and once you know it the rest is pretty straightforward. internet explorer
and netscape allow you to refer to an active server page within an image tag. example 1 demonstrates the
html to be inserted in the static page.
example 1 : html banner reference



< img src="https://www.myserver.com/servebanner.">


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("https://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)="https://www.myserver.com/banner1.gif"
array(2)="https://www.myserver.com/banner2.gif"

upperbound=ubound(array)
lowerbound=1
lrandom = int((upperbound - lowerbound + 1) * rnd + lowerbound)

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网