Table行选择
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style> .EvenOrOddRow{ background-color: expression((this.sectionRowIndex%2)?'white':'#E0E0E0'); } </style>
<script>
var currentActiveRow;
function changeActiveRow(obj) {
if(currentActiveRow)
currentActiveRow.style.backgroundColor="";
currentActiveRow=obj;
currentActiveRow.style.backgroundColor="Red";
alert(currentActiveRow.title);
}
</script>
</head>
<body>
<table width="100%">
<tr bgcolor="#aaaaaa" >
<td>Code</td><td>Name</td>
</tr>
<tr title="0001" class="EvenOrOddRow" onclick="changeActiveRow(this);">
<td>001</td><td>Googol</td>
</tr>
<tr title="0002" class="EvenOrOddRow" onclick="changeActiveRow(this);">
<td>002</td><td>CaoJia</td>
</tr>
<tr title="0003" class="EvenOrOddRow" onclick="changeActiveRow(this);">
<td>003</td><td>XueFeng</td>
</tr>
<tr title="0004" class="EvenOrOddRow" onclick="changeActiveRow(this);">
<td>004</td><td>ChenLou</td>
</tr>
</body>