Dynamic | advertising | functions | display function Showad () {
var ad_img=new Array (10);
var ad_link=new Array (10);
var ad_showtime=new Array (10);
var totle_showtim=0;
Image path for advertising
Ad_img[0]= "/img/banner/01.jpg";
Ad_img[1]= "/img/banner/02.gif";
Ad_img[2]= "/img/banner/03.gif";
Ad_img[3]= "/img/banner/04.gif";
Ad_img[4]= "/img/banner/05.gif";
Ad_img[5]= "/img/banner/06.gif";
Ad_img[6]= "/img/banner/07.gif";
Ad_img[7]= "/img/banner/08.gif";
Ad_img[8]= "/img/banner/09.gif";
Ad_img[9]= "/img/banner/10.gif";
Name of the link to put the advertisement
ad_link[0]= "#";
ad_link[1]= "#";
ad_link[2]= "#";
ad_link[3]= "#";
ad_link[4]= "#";
ad_link[5]= "#";
ad_link[6]= "#";
ad_link[7]= "#";
ad_link[8]= "#";
ad_link[9]= "#";
The probability of advertising, the greater the likelihood, must be greater than or equal to 0
ad_showtime[0]=0;
Ad_showtime[1]=1;
ad_showtime[2]=2;
ad_showtime[3]=3;
ad_showtime[4]=4;
ad_showtime[5]=5;
ad_showtime[6]=6;
ad_showtime[7]=7;
ad_showtime[8]=8;
ad_showtime[9]=9;
var i;
for (i=0;i<10;i++) {
Totle_showtim+=ad_showtime[i];
}
for (i=0;i<10;i++) {
if (i!=0) {
AD_SHOWTIME[I]+=AD_SHOWTIME[I-1];
}
}
for (i=0;i<10;i++) {
Ad_showtime[i]/=totle_showtim
}
var Display_ad;
var Rnd;
Rnd=math.random ();
if (Rnd<=ad_showtime[0]) {
Display_ad=0;
}
else if (Rnd<=ad_showtime[1]) {
display_ad=1;
}
else if (rnd<=ad_showtime[2]) {
display_ad=2;
}
else if (Rnd<=ad_showtime[3]) {
display_ad=3;
}
else if (Rnd<=ad_showtime[4]) {
display_ad=4;
}
else if (Rnd<=ad_showtime[5]) {
display_ad=5;
}
else if (Rnd<=ad_showtime[7]) {
display_ad=6;
}
else if (Rnd<=ad_showtime[7]) {
display_ad=7;
}
else if (Rnd<=ad_showtime[8]) {
display_ad=8;
}
else {
display_ad=9;
}
Writehtml= "<a href=" +ad_link[display_ad]+ "></a>";
document.write (writehtml);
}