发个惠谱的Banner特效
<script type= "text/javascript ">
var CMenu = function () {
//滑动效果
this.initialize.call(this, arguments);
};
CMenu.prototype = {
initialize : function (arg) {
//初始化参数
var wc = this;
wc.time = arg[0]; //初始化滑动延迟时间
wc.timer = 0; //初始化记时器存储变量
wc.img = null; //初始化图片为空
wc.color = null; //普通数组
wc.titles = null; //标题数组
wc.database = null; //数据组
wc.Image = []; //图片缓存组
wc.content = { left : [], center : [], right : [] }; //初始化内容
wc.root = null; //根标记
wc.now = null; //初始化当前目标成员
wc.overborder = "#FFFFFF "; //鼠标经过边框颜色
wc.initborder = "#CCCCCC "; //默认的边框颜色
wc.initcolor = "#DFDFDF "; //默认的背景颜色
},
set_content : function (id) {
//设置内容
var wc = this, con = wc.content, dat = wc.database;
con.left[1].innerHTML = dat[id].left.title;
con.center[1].innerHTML = dat[id].center.title;
wc.set_value(con.left[2], dat[id].left.value);
wc.set_value(con.center[2], dat[id].center.value);
if (dat[id].right) {
con.center[0].style.marginRight = "170px ";
con.right[0].style.display = "block ";
con.right[1].innerHTML = dat[id].right.title;
wc.set_value(con.right[2], dat[id].right.value);
} else {
con.center[0].style.marginRight = "10px ";
con.right[0].style.display = "none ";
}
wc.img.src = wc.Image[id].src;
},
set_color : function (div, id) {
//设置颜色
var wc = this;
if (wc.now) {
with (wc.now.style) {
borderColor = wc.initborder;
backgroundColor = wc.initcolor;
}
}
with (div.style) {
//设置样式
borderColor = wc.overborder;
wc.root.style.backgroundColor = backgroundColor = wc.color[id];
}
},
set_value : function (con, dat) {
//付值内容
con.innerHTML = dat.join( " <br \/> ");
},
show : function (div) {
//设置选中成员
var wc = this;
wc.timer = 0; //清空记时器
if (wc.now == div) return;
wc.set_color(div, div.t_id);
wc.set_content(div.t_id);
wc.now = div; //给选中成员重新付值
},
look : function (div, a) {
//延迟控制
var wc = this;
if (wc.timer != 0) window.clearTimeout(wc.timer); //如果有记时器清除
wc.timer = window.setTimeout(function ()