日期:2014-05-16  浏览次数:20378 次

求教:点击行如何勾选checkbox
网上找的隔行变色+点击变色+滑动变色
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<script language="javascript"><!--
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";//本来打算直接用背景色判断,FF获取到的背景是RGB值,不好判断
    this.style.backgroundColor=d;
   }else{
    this.x="0";
    this.style.backgroundColor=(this.sectionRowIndex%2==0)?a:b;
   }    
 
   var inp=document.getElementById("ck"+this.sectionRowIndex);  
   if(inp.checked)
   {
    inp.checked=false;
 }
   else 
   {
    inp.checked=true;
   }

}
  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>
        <script type="text/javascript">
            function selectAll(checkbox) {
                $('input[type=checkbox]').prop('checked', $(checkbox).prop('checked'));
            }
        </script>
        </head>
        <body>
        <table width="500" border="0" align="center" id="senfe" bgcolor="#eeeeee" >
      <tr>  
     <td  align=center><input type=checkbox name=sub > </td>  
     <td  align=center width="100">11111</td>
     <td  align=center width="100">11111</td>
     <td  align=center width="100">11111</td>
     <td  align=center width="100">11111</td>        
      </tr> 
            <tr>  
     <td  align=center><input type=checkbox name=sub> </td>  
     <td  align=center width="100">11111</td>
     <td  align=center width="100">11111</td>
     <td  align=center width="100">11111</td>
     <td  align=center width="100">11111</td