查看效果:js实现整列变颜色
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
<title>js整列换颜色</title>
</head><SCRIPT LANGUAGE="JavaScript">
<!--
var tbl = document.getElementById("orderTab"),row=tbl.rows,cel=tbl.getElementsByTagName("td"),W=0;
var H = function(i,cor){for(var n=0,c;c=row[n++];){c.cells[i].style.background=cor;}}
for(var i=0,r;r=cel[i++];){
r.onmouseover = function(){H(W,"#FFF"); W=this.cellIndex; H(W,"red")}
}
//-->
</SCRIPT>
<body>
<table width="549" height="30" align="center" border="1" cellpadding="0" cellspacing="0" id="orderTab">
<tr>
<td>表格整列换颜色</td>
<td>表格整列换颜色</td>
<td class="col">表格整列换颜色</td>
</tr>
<tr>
<td>表格整列换颜色</td>
<td>表格整列换颜色</td>
<td class="col">表格整列换颜色</td>
</tr>
<tr>
<td>表格整列换颜色</td>
<td>表格整列换颜色</td>
<td class="col">表格整列换颜色</td>
</tr>
<tr>
<td>表格整列换颜色</td>
<td>表格整列换颜色</td>
<td class="col">表格整列换颜色</td>
</tr>
<tr>
<td>表格整列换颜色</td>
<td>表格整列换颜色</td>
<td class="col">表格整列换颜色</td>
</tr>
<tr>
<td>表格整列换颜色</td>
<td>表格整列换颜色</td>
<td class="col">表格整列换颜色</td>
</tr>
</table>
</body>
</html>
中国足彩网信息请查看IT技术专栏