欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

從網(wǎng)易扒過來的js調(diào)用廣告顯示文件(隨機幾率)

 更新時間:2011年02月08日 20:59:47   作者:  
從網(wǎng)易扒過來的js調(diào)用廣告顯示文件(隨機幾率),有幾率顯示,主要是靠隨機數(shù),需要的朋友可以參考下。
從網(wǎng)易撬過來的js調(diào)用廣告顯示文件
只有下面短短幾行代碼可以隨機顯示flash和gif廣告,還不錯
復(fù)制代碼 代碼如下:

function column02(imgSource,url,chance,type) {
this.imgSource = imgSource;
this.url = url;
this.chance = chance;
this.type = type;
}
function dispColumn02() {
with (this)
switch (type){
case "img":
document.write("<A HREF=" + url + " target=_blank><IMG SRC=" + imgSource + " WIDTH=480 HEIGHT=250 BORDER=0></A>");
break;
case "html":
document.write("<IFRAME WIDTH=480 HEIGHT=250 MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=no BORDERCOLOR=#000000 SRC="+ imgSource + "></iframe>");
break;
case "flash":
document.write("<embed src="+imgSource+" quality=high width=480 height=250 type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash></embed>");
break;
default:
document.write("");
}
}
column02.prototype.dispColumn02 = dispColumn02;
columns02 = new Array();
// flash , html , img 代表三種不同的廣告模式
// 200 之類的數(shù)目是設(shè)置出現(xiàn)的機率
columns02[0] = new column02("http://smsimg.163.com/honey/honey_ad.swf","",200,"flash");//主廣告
columns02[1] = new column02("http://smsimg.163.com/honey/honey_photo.swf","",800,"flash"); //上傳圖片免月租
columns02[2] = new column02("http://smsimg.163.com/honey/honey_gold.swf","",800,"flash"); //登陸送金幣
//columns02[] = new column02("f","",100,"");// (20030422~20030722)
sum_of_all_chances = 0;
for (i = 0; i < columns02.length; i++) {
sum_of_all_chances += columns02[i].chance;
}
function randomColumn02() {
chance_limit = 0;
randomly_selected_chance = Math.round((sum_of_all_chances - 1) * Math.random()) + 1;
for (i = 0; i < columns02.length; i++) {
chance_limit += columns02[i].chance;
if (randomly_selected_chance <= chance_limit) {
columns02[i].dispColumn02();
break;
}
}
}
this_column02 = randomColumn02();

腳本之家測試代碼,chance越大顯示的幾率越大

相關(guān)文章

最新評論