轮播广告,轮流广告,轮动广告
免费使用地址:☞广告联盟轮播代码生成器
广告联盟轮播代码在线生成器免费使用。
以下是源码。
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>广告联盟轮播代码生成器_51广告联盟</title>
<meta name="keywords" content="轮播代码生成器,广告联盟,广告联盟" />
<meta name="description" content="广告联盟轮播代码生成器" />
<meta name="Copyright" content="Copyright (c) 2009-2018 www.zsj18.com" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script>
var scroll_type='weight';
var scroll_num=3;
function $(id){
return document.getElementById(id);
}
function add_ads_code(i){
var row_len = $("ads_code_table").rows.length;
var cell_len=$("ads_code_table").rows.item(0).cells.length;
var row=$("ads_code_table").insertRow(row_len);
var cell=row.insertCell(0);
cell.innerHTML='<textarea id="scroll_code_'+i+'" style="width:100%;height:100%;overflow-y:visible"></textarea>';
cell.id="td_code_"+i;
cell=row.insertCell(1);
cell.innerHTML='<input type="text" id="scroll_weight_'+i+'" value="10" style="width:50px">';
cell.id="td_num_"+i;
}
function create_table(){
var row_len = $("ads_code_table").rows.length;
scroll_num = $("scroll_num").value;
for(var i=row_len-1;i>0;i--){
$("ads_code_table").deleteRow(i);
}
for(var i=0;i<scroll_num;i++){
add_ads_code(i);
}
}
function create_code(){
var ads_code=$("ads_code_template").value;
var cookie_fun=$("ads_code_template_cookie_fun").value;
var cookie_get=$("ads_code_template_cookie_get").value;
var cookie_set=$("ads_code_template_cookie_set").value;
var ads_codes=[];
var ads_weight=[];
var ads_timer=$("scroll_timer").value;
for(var i=0;i<scroll_num;i++){
ads_codes[i]=$("scroll_code_"+i).value.replace(/\\/gi,"\\\\").replace(/\'/gi,"\\'").replace(/[\n\r]+/g,"").replace(/<\//gi,"<'+'/");
ads_weight[i]=$("scroll_weight_"+i).value;
}
ads_codes="'"+ads_codes.join("','")+"'";
ads_weight=ads_weight.join(',');
if(ads_timer>0){
ads_code=ads_code.replace(/\$cookie_fun/gi,cookie_fun);
ads_code=ads_code.replace(/\$cookie_get/gi,cookie_get);
ads_code=ads_code.replace(/\$cookie_set/gi,cookie_set);
ads_code=ads_code.replace(/\$ads_timer/gi,ads_timer);
}else{
ads_code=ads_code.replace(/\$cookie_fun/gi,"");
ads_code=ads_code.replace(/\$cookie_get/gi,"");
ads_code=ads_code.replace(/\$cookie_set/gi,"");
}
ads_code=ads_code.replace(/\$ads_codes/gi,ads_codes);
ads_code=ads_code.replace(/\$ads_weight/gi,ads_weight);
ads_code=ads_code.replace(/\n[\s|\t| ]*\r\n/g,"\n");
$("ads_code").value=ads_code;
}
function change_scroll_type(e){
$("scroll_name").innerHTML=(e.id=='weight')?"权重":"顺序";
scroll_type=e.id;
}
</script>
</head>
<body>
<center>
<h3>广告联盟轮播代码生成器</h3>
<div style="display:none">
请选择轮播方式:
<input type="radio" name="scroll_type" onclick="change_scroll_type(this)" id="rand" checked="">随机轮播
<input type="radio" name="scroll_type" onclick="change_scroll_type(this)" id="weight">权重轮播
<input type="radio" name="scroll_type" onclick="change_scroll_type(this)" id="order">顺序轮播
</div>
<div>
轮播代码个数:
<input type="text" name="scroll_num" id="scroll_num" value="3" style="width:50px">
<input type="button" value="重新生成代码框" onclick="create_table()">
</div>
<div>
<table id="ads_code_table" width="620" height="50">
<tbody><tr><td width="500" height="30">请将各联盟广告代码粘贴到以下文本框</td><td id="scroll_name" width="50">权重</td></tr>
<tr><td id="td_code_0"><textarea id="scroll_code_0" style="width:100%;height:100%;overflow-y:visible"></textarea></td><td id="td_num_0"><input type="text" id="scroll_weight_0" value="10" style="width:50px"></td></tr><tr><td id="td_code_1"><textarea id="scroll_code_1" style="width:100%;height:100%;overflow-y:visible"></textarea></td><td id="td_num_1"><input type="text" id="scroll_weight_1" value="10" style="width:50px"></td></tr><tr><td id="td_code_2"><textarea id="scroll_code_2" style="width:100%;height:100%;overflow-y:visible"></textarea></td><td id="td_num_2"><input type="text" id="scroll_weight_2" value="10" style="width:50px"></td></tr><tr><td id="td_code_3"><textarea id="scroll_code_3" style="width:100%;height:100%;overflow-y:visible"></textarea></td><td id="td_num_3"><input type="text" id="scroll_weight_3" value="10" style="width:50px"></td></tr></tbody></table>
</div>
<div>
弹出时间间隔:
<input type="text" name="scroll_time" id="scroll_timer" value="0" style="width:50px">秒内只弹一次(设置为0则为刷新弹)
</div>
<div>
<input type="button" value="开始生成轮播代码" onclick="create_code()">
</div>
<div>
<textarea style="width:600px;height:300px" id="ads_code"></textarea>
<textarea style="display:none" id="ads_code_template" readonly="">var randoms = {
ads_codes: [$ads_codes],
ads_weight: [$ads_weight],
$cookie_fun
get_random: function(weight) {
var s = eval(weight.join('+'));
var r = Math.floor(Math.random() * s);
var w = 0;
var n = weight.length - 1;
for(var k in weight){w+=weight[k];if(w>=r){n=k;break;}};
return n;
},
init: function() {
$cookie_get
var rand = randoms.get_random(randoms.ads_weight);
document.write(randoms.ads_codes[rand]);
$cookie_set
}
}
randoms.init();
</textarea>
<textarea style="display:none" id="ads_code_template_cookie_fun" readonly=""> ads_timer: $ads_timer,
get_cookie: function(n) {
var a = document.cookie.match(new RegExp("(^| )" + n + "=([^;]*)(;|$)"));
if (a != null) return decodeURI(a[2]);
return null;
},
</textarea>
<textarea style="display:none" id="ads_code_template_cookie_set" readonly=""> var time = new Date();
time.setTime(time.getTime() + randoms.ads_timer * 1000);
document.cookie = 'XCY_cookie_XCY=1;expires=' + time.toGMTString() + ';path=/;';
</textarea>
<textarea style="display:none" id="ads_code_template_cookie_get" readonly=""> if (randoms.get_cookie('XCY_cookie_XCY')) return;
</textarea>
</div>
<div>
请将以上代码复制到你的网页JS代码中,或者另存为JS文件,然后再调用它.<br>
**不要设置时间。会有需要刷新才显示的问题。就设置时间为0 **
<br>
JS调用代码:(script)(/script),自己吧括号改掉。
<br>
51导航分享——www.51yhyh.com
</div>
<script>
create_table();
</script>
</center>
<div style="display:none"></div>
<!-- 统计和推送等公共footer 开始 -->
<script>
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>
<!-- 统计和推送等公共footer 结束 -->
</body>
</html>
代码小笔记:
代码隐藏,
<div style="display:none"> <div>