名站网址导航为大家提供关于网站网页设计设计相关的的教程知识。
- 本篇文章具体介绍如下
只有下面短短几行具体代码可以随机显示flash和gif广告,还不错
具体代码如下:
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 之类的数目是设置出现的机率
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越大显示的几率越大
好了关于网站网页设计设计相关的这篇文章就给大家介绍到这里不明白的地方给本站留言。声明,本站内容来源于互联网,如果侵犯了你的权益请联系本站删除。,基于jquery的slideDown和slideUp做手风琴-网站网页设计特效→导航菜单