支持权重的无组件ASP广告显示代码
2018-09-06 11:59
网站同一显示很多广告?需要不同权重?简单的20行代码。
复制代码 代码如下:
Dimcc_fv_ad_468_80_code,cc_fv_ad_power,cc_fv_ad_i
广告权重显示明月星光Copyright原创
cc_fv_ad_power=Array(1,3,2,4)设置每个广告权重
Redimcc_fv_ad_ubound(Ubound(cc_fv_ad_power))
cc_fv_ad_ubound(0)=cc_fv_ad_power(0)
Forcc_fv_ad_i=1ToUbound(cc_fv_ad_power)
cc_fv_ad_ubound(cc_fv_ad_i)=cc_fv_ad_ubound(cc_fv_ad_i-1)+cc_fv_ad_power(cc_fv_ad_i)
Next
Randomize
Dimcc_fv_ad_j,cc_fv_ad_random,cc_fv_ad_number
cc_fv_ad_number=1
cc_fv_ad_random=Int(Rnd*cc_fv_ad_ubound(Ubound(cc_fv_ad_power)))+1
Forcc_fv_ad_j=0ToUbound(cc_fv_ad_power)
Ifcc_fv_ad_random<=cc_fv_ad_ubound(cc_fv_ad_j)Then
cc_fv_ad_number=cc_fv_ad_j
ExitFor
EndIf
Next
广告代码
cc_fv_ad_468_80_code=Array(<iframewidth=468height=60align=centermarginwidht=0name=union163commarginheight=0hspace=0vspace=0frameborder=0scrolling=nosrc=
Response.Writecc_fv_ad_468_80_code(cc_fv_ad_number)
上一篇:asp正则表达式使用详解