|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
优点:简单易学、开发速度快、有很多年“历史”,能找到非常多别人做好的程序来用、配合activeX功能强大,很多php做不到的asp+activeX能做到,例如银行安全控件程序|静态|告白ByWayneBerry
ThisIssue
Manysitesthatarecontentspecificdependonbanneradvertisementforrevenue.Suchisthecasefor15
Seconds.Abannerisdisplayedatthetopofthepageforeverypageviewed.Clientsusuallybuyaset
numberofbannerimpressionsandtheseimpressionsarerotatedamongstalltheclientsoveraperiodof
time.Inordertodothistheremustbeadynamicqualitytothebanners.Inotherwords,thebannerto
displayisnotdetermineduntilthatpageisrequested.
WithanActiveServerpagethisisaneasytask.ActiveServerPagesaredynamicandtherearemany
componentsthathandlethetaskofbannerrotation.AsimpleonecomesfreewiththeInternetInformation
Server,andmorecomplicatedrotationschedulescanbedonewithSiteServerandotherthirdparty
components.ThisarticleisnotabouthowtoimplementthesecomponentswithinyourActiveServerpages,
sincethisisafairlyeasytask.
Thisarticlewilldescribehowtoimplementabannerrotationscenariowherethepagesservedarestatic,
i.e..htm,anddonothavetheflexibilitytocallcomponents.Thetaskistodynamicallyservebanners
andstaticallyservepages.Thisistheoppositeofthescenarioforbannerrotationcomponents,which
staticallyservebannersanddynamicallyservepages.
OneTrick
Thereisonlyonetrickhereandonceyouknowittherestisprettystraightforward.InternetExplorer
andNetscapeallowyoutorefertoanActiveServerPagewithinanimagetag.Example1demonstratesthe
HTMLtobeinsertedinthestaticpage.
Example1:HTMLBannerReference
<IMGSRC="http://www.myserver.com/ServeBanner.asp">
OnceyouhavereferredtoadynamicActiveServerpagewiththestaticpage,youneedtobuildanActive
Serverpagetoreturnanimage,inthiscaseabanner.Example2showsthecodetouseforservebanner.asp
whichiscalledinExample1.
Example2:ServeBanner.aspSource
<%
Response.Redirect("http://www.myserver.com/banner.gif")
%>
Thesetwopagescombinedwillallowyoutodisplaytotheuserabannerasifyoureferreddirectlytothe
bannerimageinsteadofanActiveServerpage.Inordertodobannerrotationallyouhavetodoisexpand
Example2sodifferentimagescomeupeverytimeServeBanner.aspiscalled.
AddingtheElementofRotation.
WiththistechniquethedynamicaspectofthebannerrotationiscontrolledwithintheActiveServerpage
thattheIMGtagisreferringto.Inordertorandomlyrotatethebannersyouwillneedtochange
ServerBanner.asptochooseadifferentbannereachtimethatitiscalled.Example3showshowtodothis.
Example3:RotatingBanners
<%
DimArray(2)
InitializetheVBScriptRandom
NumberGenerator
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)
Response.Redirect(Array(lRandom))
%>
Noticethatyouwillhavetoinitializethearrayforasmanybannersasareavailableandyouwillhave
toassignabannertoeachelementofthearray.
AnExtraBenefit
AnobviousbenefittothistypeofbannerrotationisthatfactthatyoudonthavetoserveActiveServer
pagesinordertohaverotatingbanners.IftheonlydynamicaspectofyourActiveServerpageisto
rotatebannersyouwillwanttochangeittousethisbannerrotationtechnique,sinceitwillreducethe
stressonyourserver.
Itmightnotbesoobviousthatthestaticpagesnolongerneedtoresideonyourmachinetorotate
banners.Forexample,youcouldgivetheHTMLinExample1toasitethatyouwereadvertisingon,and
whentheyservetherepageswithyourHTMLyourserverwillrotatethebannersfortheirsite.Thisallows
youcontrolofwhatbannersarepresentedtotheirreaders.Thesitethatwasservingthestaticpages
couldevenbeadifferentoperatingsystem,suchasUNIX.
ClickingontheBanner
Sofarwehavedemonstratedhowtorotatebanners,butnothowtoactivatethosebannerssothatyoucan
clickonthebannertogotoanothersite.Withonebannerintherotationthisisastraightforward
process,youjustpointtheanchortagto</p>对用户来说可预见费用、节约费用,可以做到花少钱办大事。由于省去了购买软件和硬件等的前期费用,用户可以租用较高级的应用软件。ASP的收费是根据软件的类型、客制化程度、用户数量、服务期限来定的,对客户来说这笔费用是可以预见的。方便于客户应用软件的升级。 |
|