[英]How to change textbox focus color?
How to change textbox focus color? 如何更改文本框焦点颜色?
I am using different colored TextBox
es. 我正在使用不同颜色的
TextBox
。 Example dark violet, but keyboard focus is black. 示例为暗紫色,但键盘焦点为黑色。 This is bad combination.
这是不好的组合。 How I can change
TextBox
focus to gain more visual contrast? 如何更改
TextBox
焦点以获得更多视觉对比度?
A presume you're working in WPF, so try setting the FocusVisualStyle-property. 假设您正在WPF中工作,因此请尝试设置FocusVisualStyle属性。
More information about this can be found at: http://msdn.microsoft.com/en-us/library/bb613567.aspx 有关此的更多信息,请参见: http : //msdn.microsoft.com/zh-cn/library/bb613567.aspx
If for web with javascript you can do something similar to the following 如果是使用javascript的网络,则可以执行以下操作
Javascript Java脚本
function DoBlur(fld)
{
fld.className='normalfld';
}
function DoFocus(fld)
{
fld.className = 'focusfld';
}
Your CSS would have the following 您的CSS将具有以下内容
.normalfld
{
background-color: #FFFFFF;
}
.focusfld
{
background-color: #FFFFCC;
}
and for your text box 和您的文本框
then your text box will have the OnFocus and OnBlur events wired up. 那么您的文本框将连接OnFocus和OnBlur事件。
<input type="text" onblur="DoBlur(this);" onfocus="DoFocus(this);" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.