<table>

<tbody>

  <tr ><td></td></tr>

</tbody>

</table>

 

document.getElementById("test").setAttribute("onclick","Test()");

var Test=function(){

  alert(Object.prototype.toString.call(this));

};

结果显示: [object Window]

 

要想取得tr,正确的做法是:

document.getElementById("test").setAttribute("onclick","Test(this)");

var Test=function(row){

  alert(row.cells.length);

};

结果显示:1

正确了,呵呵.

相关文章: