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!

javascript form

Status
Not open for further replies.

transtech

Programmer
Aug 21, 2001
23
0
0
US
Hi all,

I have a radio (yes or no) in a form, i want to disable a textfield if i click "no" and enable again if i click "yes". Can some one please help me if you know how to do?

Thanks in advance,

Transtech
 
Code:
<script language='javascript'><!--
function disableit(answer);
{
if (answer == 0)
document.formName.txtfieldName.disabled = true;
else
document.formName.txtfieldName.disabled = false;
}
//--></script>
in your checkbox tags:
<input type=&quot;checkbox&quot; value=&quot;yes&quot; onClick='disableit(0)'>
<input type=&quot;checkbox&quot; value=&quot;no&quot; onClick='disableit(1)'>
hope it helps! Suceess, thats the way you spell success!
Got a question? Ask IMOZRMY!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top