1、简单的,表格中的一行添加id属性
var item=document.getElementById("id");
2、在行本身绑定方法将自身作为参数传递
<html>
<head>
<script type = 'text/javascript'>
var curRow; //全局行号
var curRowId; //选中行的记录信息的ID
var curColor;
function selectRow(tr){//tr行本身
curRow = tr;
curRowId = tr.id;
alert(tr.cells[0].innerText);
}
</script>
</head>
<body onload = "javascript:selectRow(1)">
<table border = "1 solid">
<tr onclick = "selectRow(this);">
<td>001</td>
<td>google</td>
</tr>
<tr onclick = "selectRow(this);">
<td>002</td>
<td>baidu</td>
</tr>
</table>
</body>
</html>
3、获取所有行集合,然后通过下标访问某一行
var items=document.getElementByTagName("tr");
//获取某一行(下标从0开始,到items.length-1结束)
var hang=items[0];