faqts : Computers : Programming : Languages : JavaScript : Forms

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

263 of 306 people (86%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

How to Enable / Disable TextArea based on Checkbox
How to Enable / Disable TextArea based on Checkbox
How to Enable / Disable TextArea based on Checkbox

Dec 20th, 2001 12:16
Arsen Yeremin,


<html>
<head>
	<title>Enable / Disable</title>
  <script>
    function SetState(obj_checkbox, obj_textarea)
    {  if(obj_checkbox.checked)
       { obj_textarea.disabled = true;
       }
       else
       { obj_textarea.disabled = false;
       }
    }
  </script>
</head>
<body>
  <form>
    <input type="checkbox" onclick="SetState(this, 
this.form.my_text)"><br>
    <textarea name="my_text">name:Arsen Yeremin</textarea>
    <br>
  </form>
</body>
</html>