作者b8888 (b8888)
看板Visual_Basic
标题Re: [ASP ] 文字方块获得焦点时变色
时间Sun Mar 31 00:36:46 2013
先谢谢brian90191的回答
我参考了
http://blog.csdn.net/jiang0609/article/details/5889830
修正我的需求为
在<head> </head>中加入
<script>
function ChgBgColor(con,color)
{
con.style.backgroundColor=color;
}
function ChgLostColor(con,color)
{
con.style.backgroundColor=color;
}
</script
在
Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
TextBox1.Attributes.Add("onfocus", "ChgBgColor(this,'#9FF')")
TextBox1.Attributes.Add("onlostfocus", "ChgLostColor(this,'white')")
TextBox2.Attributes.Add("onfocus", "ChgBgColor(this,'#9FF')")
TextBox2.Attributes.Add("onlostfocus", "ChgLostColor(this,'white')")
TextBox3.Attributes.Add("onfocus", "ChgBgColor(this,'#9FF')")
TextBox3.Attributes.Add("onlostfocus", "ChgLostColor(this,'white')
End Sub
当文字方块取得焦点时,会变色
但是离开文字方块後却不会变成白色
请问我该如何修正,或有资料可供参考,
先谢谢您的回答
※ 引述《b8888 (b8888)》之铭言:
: 各位大大好
: 小弟有一个问题,请问
: 在ASP.NET有三个文字方块,
: 我该如何在文字取得焦点时,改变颜色
: 离开後又变回白色
: 先谢谢您的回答
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.47.219.44
1F:推 brian90191:onlostfocus 改成 OnBlur 03/31 01:35