点击某一行改变背景色 ,并且动态获取HTML中TD的值

HTML 代码:

<s:iterator value="_jobAlertList" status="pc">
<tr onclick="clickCurRow(this)" id="jobAlertTr">

<td width="2%" class="date setc" id="jobAlertNum"> <s:property value="Num"/></td> 
<td width="10%" height="29px" align="left" id="jobAlertName<s:property value="#pc.index"/>"> 
 <s:property value="HANDLER_NAME"/> 
</td>
<td width="20%" height="29px"> <s:property value="TITLE"/> </td>
<td width="10%" height="29px" id="jobAlertCount">  <s:property value="COUNT"/> </td>
</tr> 
 </s:iterator>  


JS 代码:

var jobAlertId="";

function clickCurRow(curRow)
{
jobAlertId = eval(curRow.rowIndex); 
$(curRow).css("background-color", "#e5e5e5").siblings().css("background-color", ""); //改变背景色
jobAlertId= jobAlertId-1; 
jobAlertName = $("#jobAlertName" +jobAlertId).html(); //获取TD值   
}

你可能感兴趣的:(获取HTML中TD的值)