1 <html> 2 <head> 3 <meta charset="UTF-8"> 4 <title></title> 5 </head> 6 <body> 7 <input id="aaa" type="checkbox" onclick="check()" /> 8 <input type="button" value="下一步" id="btn" disabled="disabled"/> 9 </body> 10 </html> 11 <script> 12 function check(){ 13 var aaa = document.getElementById('aaa'); 14 if(aaa.checked){ 15 document.getElementById('btn').removeAttribute('disabled'); 16 }else{ 17 document.getElementById('btn').setAttribute('disabled','disabled'); 18 } 19 } 20 </script>
removeAttribute('要删除的属性') 删除属性
setAttribute('属性','属性值') 添加属性