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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

making disables text boxes gray

Status
Not open for further replies.

blueindian1

Programmer
Apr 24, 2001
150
US
Hi,

Is it possible to make a disabled text box gray?

Thanks,

Rich
 
Hi rich,

try this:

<script language=&quot;javascript&quot;>
function makegrey()
{
if (document.MyForm2.radio5.value = 'yes')
{
document.MyForm2.textbox7.disabled = true;
document.MyForm2.textbox7.style.backgroundColor = '#C0C0C0';
}
}

function makenormal()
{
if (document.MyForm2.radio5.value = 'no')
{
document.MyForm2.textbox7.disabled = false;
document.MyForm2.textbox7.style.backgroundColor = '#FFFFFF';
}
}
</script>


<form name=&quot;MyForm2&quot;>
Do you want to grey the textbox when it is disabled?
<input onclick=&quot;javascript:makegrey();&quot; value=&quot;yes&quot; type=&quot;radio&quot; name=&quot;radio5&quot; id=&quot;radio5&quot;>Yes
<input onclick=&quot;javascript:makenormal();&quot; value=&quot;no&quot; type=&quot;radio&quot; name=&quot;radio5&quot; id=&quot;radio5&quot;>No
<br>
<input type=&quot;text&quot; name=&quot;textbox7&quot; id=&quot;textbox7&quot;>
<br>
</form>

Hope this helps,
Erik
 
this works fine in straight html, but when i try to generate it in asp using layers it won't work. any ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top