datalist里,如何让我选择的行变色

来源:百度知道 编辑:UC知道 时间:2024/05/23 17:11:20
datalist模板里有一个table,table是两行一列,第一行是一个图标,第二行是一个label,想在我想实现单击哪行,哪行就变色,然后操作该行的数据,希望大家指点.
再问一下,颜色变了,怎么获得或操作里面的数据呢??

一:
<td onclick="this.style.backgroundColor='red'" onmouseout="this.style.backgroundColor=''">Test</td>
二:
给datalist里的Table中Label注册事件
Label1.Attributes.Add("onclick", "Test1(this)");
Label1.Attributes.Add("onmouseout", "Test2(this)");
前台JS
function Test1(obj)
{
obj.style.backgroundColor = 'red';
//你要的值
//alert(obj.innerText);
}
function Test2(obj)
{
obj.style.backgroundColor = '';
}

有 click事件啊

<ItemTemplate>
<tr onmouseover="this.style.backgroundColor=''" onmouseout="this.style.backgroundColor=''" >
.....