faqts : Computers : Programming : Languages : JavaScript : Forms : SELECT

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

202 of 264 people (77%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How can I enable\disable a textbox? For example: select Hi! enable and selecting Bye! disable?

Jan 10th, 2002 06:54
Sc0uSe, Erik Heidstra,


<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT LANGUAGE=Javascript>
function disable(OnOff) {
	txtBox.disabled=OnOff;
}
</SCRIPT>
</HEAD>
<BODY>

<!-- this is the text box to enable/disable -->
<INPUT TYPE=TEXT name='txtBox' id='txtBox' VALUE='watch this space'>
<INPUT VALUE='DISABLE' TYPE=BUTTON onClick=disable(true);>
<INPUT VALUE='ENABLE' TYPE=BUTTON onClick=disable(false);>

</BODY>
</HTML>

Hope this helps,

Sc0uSe