复选框绑定文本框,使文本框变灰

<script type="text/javascript">
function changeStatistics(){
var val = $("#statistics").val();
if(val=="A"){
  $("#agents").css("background-color","").removeAttr("disabled");
}else{
  $("#agents").css("background-color","#F2F2F2").val("").attr("disabled","disabled");
}
}
$(function(){
changeStatistics();
});
</script>


<th>
考勤统计 :
</th>
<td>
<select name="statistics" id="statistics" class="input-txt" style="width: 123px;" onchange="changeStatistics()">
<option value="A" ${statistics=='A'?'selected':''}>个人</option> <option value="B" ${statistics=='B'?'selected':''}>职级</option> </select>
</td> <th> 营 销 员: </th> <td> <input name="agents" id="agents" type="text" class="inputbox" disabled="disabled" value="${agents}" </td>

你可能感兴趣的:(文本框)