日期:2014-05-19  浏览次数:20468 次

请问datalist的变色问题
我现在在datalist中放了一个html的table   table中放了一个web的checkbox
请问怎么能够在点击checkbox的时候让所选项的table背景色改变
谢谢

------解决方案--------------------
<table name= 'tb <%# DataBinder.Eval(Container.DataItem, "ID ")%> '>
<tr>
<td>
<input type= "checkbox " onchange= 'javascript:if(this.checked)changeStyle( <%# DataBinder.Eval(Container.DataItem, "ID ")%> ) ' />
</td>
</tr>
</table>
<script language=javascript>
function changeStyle(id)
{
document.getElementById( "tb " + id).style.bgcolor = "#f00 ";
}
</script>