This script works to enable the textfield 'otherz' from
'D1' select option 'Others'.
HTML
<select size="1" name="D1" onChange="dis_able()">
<option>Category A</option>
<option>Category B</option>
<option>Category C</option>
<option value="Others">Others</option>
</select>
<input disabled type="text" name="otherz" size="20" value="pls specify"></p>
Javascript
function dis_able()
{
if(document.myform.D1.value != 'Others')
document.myform.otherz.disabled=1;
else
document.myform.otherz.disabled=0;
}
My questions is: how can this be rewritten so it will enable/disable other textfields associated with other dropdown menus? (as if we have the same code, but the select name "D2", "D3"...etc. and text field to enable associated with that select: "otherz2", "otherz3".
Thank you for your help.
'D1' select option 'Others'.
HTML
<select size="1" name="D1" onChange="dis_able()">
<option>Category A</option>
<option>Category B</option>
<option>Category C</option>
<option value="Others">Others</option>
</select>
<input disabled type="text" name="otherz" size="20" value="pls specify"></p>
Javascript
function dis_able()
{
if(document.myform.D1.value != 'Others')
document.myform.otherz.disabled=1;
else
document.myform.otherz.disabled=0;
}
My questions is: how can this be rewritten so it will enable/disable other textfields associated with other dropdown menus? (as if we have the same code, but the select name "D2", "D3"...etc. and text field to enable associated with that select: "otherz2", "otherz3".
Thank you for your help.