unction 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;
  }
 }
} var t=document.getElementById(o).getElementsByTagName("tr");这里的o是table,t是什么? if(this.x!="1")这里的this指的是什么?this.x又是什么属性,有没有其它属性?麻烦介绍下下。

解决方案 »

  1.   

    如果this代表当的是行(tr) 那tr有x这个属性吗? 怎么以前都没听过,希望高手具体的介绍下
      

  2.   

    <table>
    <tr onclick="alert(this.x);" x="abc">
    <td>
    aaaaaaaaaa</td>
    </tr>
    </table>
    HTML属性是可以自定义的,不光只是那几个
      

  3.   

    嗯  这个好明白 关键是 this.x 没见过,虽然知道它作用是什么,网上都查不到有这么一说,心里毛的很,哪位哥哥来帮我解释下啊
      

  4.   

    楼主,,this.x应该是指function senfe()这个函数的哈。可以自定义的。。比如你可以这样定义
    function test()
    {
    this.name = "louzhu";
    this.sex = "woman";
    alert(this.name);
    }
    呵呵
      

  5.   

    这里的this应该是tr吧,事件的调用者
      

  6.   

    LZ想知道this是什么跟踪一下就知道了