作者b8888 (b8888)
看板Visual_Basic
标题Re: [ASP ] 文字方块获得焦点时变色
时间Sun Mar 31 12:41:54 2013
谢谢 brian90191大的回答
小弟又有一个类以的问题
若想将网页置於最上层,我目前使用的方法是
在 body 中加入
onBlur="setTimeout('self.focus()', 200)"
但是加入後最会与文字方块变色的功能互冲
(即文字方块获得焦点後会暂时变色,但一下子即变成白色的)
-->文字方块焦点会跑掉,
请问有没有什麽方法可以同时满足的
1.文字方块获得/失去焦点会变色
2.该网页置於最上层
先谢谢大家的回答
※ 引述《b8888 (b8888)》之铭言:
: 先谢谢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: 210.61.177.91
1F:→ MOONRAKER:这样user不是除你的web程式以外什麽都不能做了。 03/31 14:12
2F:→ fumizuki:没有网页在做最上层显示的啦 除非想干坏事... 03/31 16:47
3F:→ fumizuki:网页都是使用者想看哪个分页就看哪个分页... 03/31 16:48
4F:→ MOONRAKER:没错 不要做这种破坏秩序的事情 03/31 17:03