看板 Visual_Basic 關於我們 聯絡資訊
先謝謝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
brian90191:onlostfocus 改成 OnBlur 03/31 01:35