日期:2014-05-16  浏览次数:20426 次

checkbox控制file的disabled问题
请问怎么样让一个checkbox   checked的时候让file的disabled=false?
<input   type= "checkbox "   id= "checkbox "onclick= "return   disable(); ">
<input   type= "file "   id= "file "   disabled>

<script>
function   disable(){
if(document.getElementById( "checkbox ").checked){
document.getElementById( "file ").disabled=false;
}
}
</script>

------解决方案--------------------
<script>
function disable(){
if(document.getElementById( "checkbox ").checked){
document.getElementById( "file ").disabled=false;
}
else
document.getElementById( "file ").disabled=true;
}
</script>
------解决方案--------------------
<input type= "checkbox " id= "checkbox "onclick= " disable(); ">
<input type= "file " id= "filea " disabled>

<script>
function disable(){
if(document.getElementById( "checkbox ").checked){
document.getElementById( "filea ").disabled=false;
}
}
</script>


把id换一下