How to make a blank text field grey out
I would like to know how to make a blank text field grey out? I know that when there is content, i can grey out the text field using
document.mainForm.data.disabled = true;
but how do make the whole text field grey out when there is no data in it?
Thank you.
[286 byte] By [
dummyagain] at [2007-11-20 9:20:55]

# 1 Re: How to make a blank text field grey out
The field always grays out (and becomes disabled) when you set its disabled property (in IE it never changes background color, maybe that's what you mean?), but if you only want it to visually gray out, you can use CSS (field.style.backgroundColor = "#ddd").
# 2 Re: How to make a blank text field grey out
Try...
<input type="text" onfocus="this.style.background='#ffffff'" onblur="if(this.value==''){this.style.background='#dddddd'}" />