关于修改文本框的背景色
怎样才能在 *.aspx.vb 中写一个sub,在page_load中调用,使得界面上的所有可输入框在获得焦点时背景色发生变化。我试着用for each ... in,但是没有效果。(界面上用的是web控件)
this is my source code:
Private Sub SetColor()
'Dim txtCtrl As System.Web.UI.Control
Dim txtCtrl As Object
For Each txtCtrl In Me.Controls
If TypeOf txtCtrl Is TextBox Then
txtCtrl.Attributes.Add("onfocus", "this.style.backgroundColor='#ffffc0';")
txtCtrl.Attributes.Add("onblur", "this.style.backgroundColor='#ffffff';")
End If
Next txtCtrl
End Sub