js如何实现变色的同时选中复选框
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>001</title>
</head>
<body>
<center>
<table id="senfe">
<tr>
<th>选择</th><th>姓名</th><th>性别</th><th>民族</th><th>电话</th>
</tr>
<tr>
<td><input type='checkbox' id='checkbox[]' name='checkbox[]'></td>
<td>1</td><td>2</td><td>3</td><td>4</td>
</tr>
<tr>
<td><input type='checkbox' id='checkbox[]' name='checkbox[]'></td>
<td>1</td><td>2</td><td>3</td><td>4</td>
</tr>
<tr>
<td><input type='checkbox' id='checkbox[]' name='checkbox[]'></td>
<td>1</td><td>2</td><td>3</td><td>4</td>
</tr>
<tr>
<td><input type='checkbox' id='checkbox[]' name='checkbox[]'></td>
<td>1</td><td>2</td><td>3</td><td>4</td>
</tr>
<tr>
<td><input type='checkbox' id='checkbox[]' name='checkbox[]'></td>
<td>1</td><td>2</td><td>3</td><td>4</td>
</tr>
</table>
</center>
<script language="javascript">
senfe("senfe","#E0E0E0","#ccc","#2894FF","#02F78E"); //senfe("表格名称","奇数行背景","偶数行背景","鼠标经过背景","点击后背景");
function senfe(o,a,b,c,d){ //隔行变色的同时,鼠标滑过和点击都会变色
var t=document.getElementById(o).getElementsByTagName("tr");
for(var i=0;i<t.length;i++){
t[i].style.backgroundColor=(t[i].sectionRowIndex%2==0)?a:b;
t[i].onclick=function(){
if(this.x!="1"){
this.x="1";
this.style.backgroundColor=d;
}else{
this.x="0";
this.style.backgroundColor=(this.sectionRowIndex%2==0)?a:b;
}
}
t[i].onmouseover=function(){
if(this.x!="1")this.style.backgroundColor=c;
}
t[i].onmouseout=function(){
if(this.x!="1")this.style.backgroundColor=(this.sectionRowIndex%2==0)?a:b;
}
}
}
</script>
</body>
</html>