怎么不行? Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load '在此处放置初始化页的用户代码 Me.TextBox1.Attributes.Add("onfocus", "window.Label1.style.backgroundColor ='#336699';") '获得焦点 Me.TextBox1.Attributes.Add("onblur", "window.Label1.style.backgroundColor ='#ff0000';") '失去焦点 End Sub在我这儿可以正常运行的.你有什么错误吗?
entet 不是吗?
<HEAD>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function text1_onfocus() {
window.text1.style.backgroundColor = "#ff0000";
}
//-->
</SCRIPT>
</HEAD>
<BODY><P><INPUT id=text1 name=text1 LANGUAGE=javascript onfocus="return text1_onfocus()"></P></BODY>
</HTML>
if(!Page.IsPostBack)
{
txt_Test.Attribute.Add("onfocus","return text1_onfocus()")
}
Me.TextBox1.Attributes.Add("onfocus", "window.Label1.style.backgroundColor ='#336699';")C#this.TextBox1.Attributes.add("onfocus", "window.Label1.style.backgroundColor='#336699';");
Label1就是标签啊.
100mb 的!可以做论坛!才 50元!!速度飞快!
www.hi876.com 你们看看
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
Me.TextBox1.Attributes.Add("onfocus", "window.Label1.style.backgroundColor ='#336699';")
'获得焦点
Me.TextBox1.Attributes.Add("onblur", "window.Label1.style.backgroundColor ='#ff0000';")
'失去焦点
End Sub在我这儿可以正常运行的.你有什么错误吗?
private void Page_Load(object sender, System.EventArgs e)
{
this.TextBox1.Attributes.Add("onfocus", "window.Label1.style.backgroundColor ='#336699';");
this.TextBox1.Attributes.Add("onblur", "window.Label1.style.backgroundColor ='#ff0000';");
}
大侠现在好了.再请教一下:
如果我想让标签上的文字改变.
在Add("","这里应该如何写呢.同时色彩也想变化.")