Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to keep XP field style (2D) but change background color

Status
Not open for further replies.

Kindon

Programmer
Apr 19, 2001
54
0
0
US
Problem: When setting the background color style on a field the field style reverts to non-XP 2D style.
Target browser: IE 5.5/6.X
Problem OS: WindowsXP

I am working on an application that has some dynamic field interaction. Field2 is disabled unless field1 is populated. This works fine. Disabled fields do not visually show the user it is disabled. Here is an example:

<input type="text" id="field2" disabled>

So I added style background color to make it look disabled:

<input type="text" id="field2" disabled style="background:#eeeeee;">

This brought on a problem with WindowsXP. In pre-XP Windows, the fields are all 3D text fields unless you change it with CSS. In XP the default is XP's style (2D) unless you change it wil CSS. But when you change the background like I did above, IE does not change only the background, but the whole style reverts back to the 3D style. Run this in IE on XP to see the difference:

<input type="text" disabled>
<input type="text" disabled style="background:#eeeeee;">

Of course the true solution is to force all fields to conform to your own style. Then I have total control. Unfortunately this is not an option right now.

Here is a snippet that I have that shows this happening:
<html><body>
<input type="text" id="field2"><br>
<input type="button" value="3D return!" onclick="field2.style.cssText='';"><br>
<input type="button" value="Gimmie 2D!" onclick="field2.style.background='#eeeeee';"><br>
</body></html>

Is there any way to keep the XP style (2D look) of the text field, but change the background color? In other words change only the background color.

Kindon
 
Try the "borderStyle='solid';" setting. I think you'll find that when you set the background color, it will revert to a border style of "inset". A good website for "playing" with the border style is:

Hope this helps.

Pete.


Web Developer & Aptrix / IBM Lotus Workplace Web Content Management (LWWCM) Specialist
w: e: Pete.Raleigh(at)lclimited.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top