在这段代码中,我们需要在状态(上方字段)中选择 APPROVED 时禁用 Department 字段,并且在选择 CLARIFICATIONS 时应该启用它必须启用。请尝试帮助我们!
<form name="index" action="Director">
<table border="0" style="width:300px">
<tbody bgcolor>
<p> Date: <%= df.format(new java.util.Date()) %> </p>
<tr>
<td height="40"><font color="Blue">Branch:</td>
<td>
<select name="dbranch" id="dbranch" >
<option value="Select">Select</option>
<option value="Kakinada">Kakinada</option>
<option value="Vishakapatnam">Vishakapatnam</option>
<option value="Tirupathi">Tirupathi</option>
<option value="Vijayawada">Vijayawada</option>
<option value="Warangal">Warangal</option>
<option value="Hyderabad">Hyderabad</option>
</select>
</td>
</tr>
<tr>
<td height="40"><font color="Blue">Doc id :</td>
<td>
<select id="inw_id" name="inw_id">
<option value='0'>Select Doc ID</option>
</select>
</td>
</tr>
<tr>
<td height="40"><font color="Blue">Status: </td>
<td>
<select name="status" id="status" >
<option value="">Status</option>
<option value="Approved">Approved</option>
<option value="Clarifications">Clarifications</option>
</select>
</td>
</tr>
<tr>
<td height="40"><font color="Blue">Department: </td>
<td>
<select name="dept" id="dept" >
<option value=""> </option>
<option value="Admin">Admin</option>
<option value="Accounts">Accounts</option>
<option value="Other">Other</option>
</select>
</td>
</tr>
</tbody>
</table>
<tr><td><td align="right"><input name="submit" type="submit" value="Submit"style="background-color:LightBlue;margin-left:15px;height: 40px;width: 100px; margin-right: -30px;"></td></td></tr>
</form>
我们尝试编写一个函数,但它不起作用:(
function doenable() {
if(document.getElementById("status")!="null") {
document.getElementById("department").disabled=false;
}
}