隔行换色*{border:none;}
table{width:100%;border:1px solid silver;margin-bottom:30px;background:#F8F8F8}
//代码如下
var G = function(id){return document.getElementById(id)}
var EACH = function(o,fn){for(var i=0;i
var _2009_ = function(){this.init.apply(this,arguments)};
_2009_.prototype={
init:function(o){
EACH(G(o.id).rows,function(i,O){i%2== +!!o.parity ? this.style.background = o.cor1:'';
this['color'] = this.style.background;
this.onmouseover = function(){this.style.background = o.cor2}
this.onmouseout = function(){this.style.background = this['color']}
})
}
};
new _2009_({id:'tb1',cor1:'#CCC',cor2:'#0066CC'});
new _2009_({id:'tb2',cor1:'#CCC',cor2:'#0066CC',parity:'默认是奇数,设了就是偶数'});
阅读(277) | 评论(0) | 转发(0) |