asp:TextBox backgroundColor change also affects borderStyle?
-
I have an ASP .NET page with some text boxes, where I set the javascript events onfocus and onblur to change the backgroundColor, so the code is something like what's below:
function setBackgroundColor(elementID, color)
{
var control = document.getElementById(elementID);
control.style.backgroundColor = color;
}The problem is, as soon as this happens, the borderStyle also changes from the original flat/solid borderStyle to one that's 3D (not sure which one though). Does anyone know why these two backgroundColor and borderStyle properties are tied to each other and how I'd go about only changing just the backgroundColor?
-
I have an ASP .NET page with some text boxes, where I set the javascript events onfocus and onblur to change the backgroundColor, so the code is something like what's below:
function setBackgroundColor(elementID, color)
{
var control = document.getElementById(elementID);
control.style.backgroundColor = color;
}The problem is, as soon as this happens, the borderStyle also changes from the original flat/solid borderStyle to one that's 3D (not sure which one though). Does anyone know why these two backgroundColor and borderStyle properties are tied to each other and how I'd go about only changing just the backgroundColor?
The idea is that the browser uses the underlying OS's rendering capabilities to standard form controls (like buttons or text boxes). As soon as you change attributes/properties/styles that the OS cannot render anymore, the browser switches from an OS rendered control to an ownerdrawn control. Happens e.g. inside Google applications quite often, too. You could set the border always explicitely to avoid the "flipping" you described.
• My personal 24/7 webcam - Always live ;-) • Holiday Season special – zeta producer Desktop 8 (CMS) including all modules for only $129! • Zeta Uploader - Easily send large files by e-mail. Windows and web client available.
-
The idea is that the browser uses the underlying OS's rendering capabilities to standard form controls (like buttons or text boxes). As soon as you change attributes/properties/styles that the OS cannot render anymore, the browser switches from an OS rendered control to an ownerdrawn control. Happens e.g. inside Google applications quite often, too. You could set the border always explicitely to avoid the "flipping" you described.
• My personal 24/7 webcam - Always live ;-) • Holiday Season special – zeta producer Desktop 8 (CMS) including all modules for only $129! • Zeta Uploader - Easily send large files by e-mail. Windows and web client available.
Interesting, thanks for the info. I tried setting the borderStyle to solid, and then it changed the border outline to a different color (black) than what the OS renders (I guess), which is something like a light blue-ish color. In the end, I just said "screw it, 3D border style it is", since it seemed to look alright.