JQuery代码
$(function () {
var TaskType = '';
$("#data_table tr:gt(0)").click(function () {
TaskType = $(this).find("td").eq(0).html();
alert(TaskType)
})
HTML代码
<table id="data_table" style="background-color:white;font-size:24px;width:100%;word-break:keep-all;white-space:nowrap">
<tr>
<td colspan="4">任务列表</td>
</tr>
<tr style="background-color:antiquewhite">
@*<td>选择</td>*@
<td>类型</td>
<td>客户</td>
<td>单号</td>
<td>任务接受时间</td>
</tr>
@{
int SequenceNo = 0;
string BackGroundColor = "";
foreach (var x in @Model)
{
BackGroundColor = (SequenceNo % 2) == 0 ? "background-color:skyblue" : "background-color:white";
SequenceNo = SequenceNo + 1;
<tr style="@BackGroundColor">
@*<td style="width:1px" ><input type="checkbox" id="select"/></td>*@
<td>@x.TaskType</td>
<td>@x.CustomerName</td>
<td>@x.CKBillID</td>
<td >@x.TaskTime</td>
<td style="visibility:hidden">@x.TaskID</td>
</tr>
}
}
</table>