I've got a simple function I can't get to work. I've got two checkboxes that are associated with two textarea inputs. I disable the text areas initially. When the associated checkbox is clicked, I want it to enable that text area... and vice versa. Like a toggle.
My form is called pay_form. (The form actually spans several tables, in case that matters). Here's the tag for it:
Expand|Select|Wrap|Line Numbers
- <form ACTION="checkout3.php" method="POST" name="pay_form" id="pay_form" onSubmit="return chkPayForm();" style="margin:0;">
Expand|Select|Wrap|Line Numbers
- <input type="checkbox" name="commentbox" id="commentbox" value="0" onClick="msgBox('order_msg');" align="bottom"/>
- <input type="checkbox" name="giftbox" id="giftbox" value="0" onClick="msgBox('gift_msg');" align="bottom"/>
Expand|Select|Wrap|Line Numbers
- <textarea name="order_msg" id="order_msg" cols="20" rows="3" maxlength="255" disabled></textarea>
- <textarea name="gift_msg" id="gift_msg" cols="40" rows="3" maxlength="255" disabled></textarea>
Expand|Select|Wrap|Line Numbers
- function msgBox(element) {
- var frm = document.pay_form;
- if (frm.element.disabled == true) {
- frm.element.disabled = false;
- } else { frm.element.disabled = true; }
- }