Guf*_*ffa 49
把它放在复选框中:
onclick="document.getElementById('IdOfTheTextbox').disabled=this.checked;"
Run Code Online (Sandbox Code Playgroud)
kem*_*002 16
<input type="text" id="textBox">
<input type="checkbox" id="checkBox" onclick="enableDisable(this.checked, 'textBox')">
<script language="javascript">
function enableDisable(bEnable, textBoxID)
{
document.getElementById(textBoxID).disabled = !bEnable
}
</script>
Run Code Online (Sandbox Code Playgroud)
小智 5
jQuery(document).ready(function () {
$("#checkBox").click(function () {
$('#textBox').attr("disabled", $(this).is(":checked"));
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
84351 次 |
| 最近记录: |