JS代码:
<!--
function onloadEvent(func){
var one=window.onload
if(typeof window.onload!='function'){
window.onload=func
}
else{
window.onload=function(){
one();
func();
}
}
}
function showtable(){
var tableid='table';
var overcolor='#EEEEEE';
var color1='#FFFFFF';
var color2='#F8F8F8';
var tablename=document.getElementById(tableid)
var tr=tablename.getElementsByTagName("tr")
for(var i=1 ;i<tr.length;i++){
tr[i].onmouseover=function(){
this.style.backgroundColor=overcolor;
}
tr[i].onmouseout=function(){
if(this.rowIndex%2==0){
this.style.backgroundColor=color1;
}else{
this.style.backgroundColor=color2;
}
}
if(i%2==0){
tr[i].className="color1";
}else{
tr[i].className="color2";
}
}
}
onloadEvent(showtable);
-->
CSS样式:
.ContentRight .products .text table{ width: 100%; border-collapse:collapse;}
.ContentRight .products .text table td{ border: 1px solid #ccc; padding-left: 7px; line-height: 21px; }
.ContentRight .products .text table .th td{ background: #E9EAE9; line-height: 25px; font-weight:bold;}
#table tr.color1{ background-color:#fafafa;}
#table tr.color2{ background-color:#fff;}