Grey out textfield

How do you grey out a textfield? Make it read-only
funksoulAsked:
Who is Participating?
 
Michel PlungjanConnect With a Mentor IT ExpertCommented:
Xabis solution is correct, however it always disables the field.

Here is ow it should be

<input type="text" name="foo" value ="foo" onfocus="if (this.disabled) this.blur()">

it will NOT be greyed out in Netscape but it WILL be disabled using
document.forms[0].elements[0].disabled=true;

Michel
0
 
daveamourCommented:
<Input Type="Text" Name="Firstname" Value="Smith" Readonly>

Dave
0
 
xabiCommented:
This will be a better solution:

<input type="text" name="foo" value ="foo" onfocus="this.blur()" Readonly>

cause readonly tag is only IE compatible.

xabi
0
 
funksoulAuthor Commented:
I need to know how to do this by using Javascript...

document.forms[0].elements[0].disabled=true

but this only works for IE...does Netscape support grey-out readonly.
0
 
funksoulAuthor Commented:
I wish I could give you both points...but thanks fo r the help...only wish Netscape has the grey out option too.
0
All Courses

From novice to tech pro — start learning today.