可以用JAVASCRIPT代码实现背景色变化,javascrip代码如下:
<script type="text/javascript">
var dataListId = "<%=DataList1.ClientID%>";
function Change_DivLine_Color()
{
var rows=document.getElementById("DataList1").rows;
for(k=0; k<rows.length; k++)
{
if(rows[k].cells[0].getElementsByTagName("span")[0].innerHTML == "1")
{
rows[k].style.backgroundColor="#FF00BB";
}
if(rows[k].cells[0].getElementsByTagName("span")[0].innerHTML == "2")
{
rows[k].style.backgroundColor="#00FFEE";
}
if(rows[k].cells[0].getElementsByTagName("span")[0].innerHTML == "3")
{
rows[k].style.backgroundColor="#CC00FF";
}
}
}
window.onload=Change_DivLine_Color;
</script> |