开发者

How to change textbox focus color?

开发者 https://www.devze.com 2022-12-19 01:24 出处:网络
How to change textbox focus c开发者_如何学Pythonolor? I am using different colored TextBoxes. Example dark violet, but keyboard focus is black. This is bad combination. How I can change TextBox focus

How to change textbox focus c开发者_如何学Pythonolor?

I am using different colored TextBoxes. Example dark violet, but keyboard focus is black. This is bad combination. How I can change TextBox focus to gain more visual contrast?


A presume you're working in WPF, so try setting the FocusVisualStyle-property.

More information about this can be found at: http://msdn.microsoft.com/en-us/library/bb613567.aspx


If for web with javascript you can do something similar to the following

Javascript

function DoBlur(fld) 
{
    fld.className='normalfld';
}

function DoFocus(fld) 
{
    fld.className = 'focusfld';
}

Your CSS would have the following

.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.

<input type="text" onblur="DoBlur(this);" onfocus="DoFocus(this);" /> 
0

精彩评论

暂无评论...
验证码 换一张
取 消