1
在选择/取消选择时,复选框列表中的listitem中文本的颜色是否可以用颜色来回切换?CheckboxList中的ListItems文字颜色变化
我想这样做与下面的代码无济于事。 ChartstoDisplay是复选框列表的ID
Protected Sub ChartstoDisplay_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles ChartstoDisplay.SelectedIndexChanged
For i As Integer = 0 To ChartstoDisplay.Items.Count - 1
If ChartstoDisplay.Items(i).Selected Then
ChartstoDisplay.Items(i).Attributes.Add("style", "color:DarkGreen;")
Else
ChartstoDisplay.Items(i).Attributes.Add("style", """")
End If
Next
End Sub
你绝对需要通过代码背后做到这一点,或者你是否愿意做JavaScript?通过后面的代码做会让你的网页看起来很跳跃,除非这是坐在更新面板中......但为什么浏览器可以做到这一点时服务器工作 – peroija
林教我自己jquery现在,一个例子将不胜感激 – dinotom