勾选复选框按钮可用否则不可用 function check(){ var chec=document.getElementById("chec"); if(chec.checked==true){ alert(1111) document.getElementById("btn").removeAttribute("disabled") }else{ alert(22222) document.getElementById("btn").disabled="disabled" }}
<div class="form-group"> <div class="col-sm-offset-2 col-sm-6"> <div class="checkbox"> <label> <input type="checkbox" id="chec" onclick="check()" > 我已看过并接受 <span id="xieyi" onclick="foo3()">《用户协议》</span> </label> </div> </div></div><div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="button" class="btn btn-default" id="btn" disabled>立即注册</button> </div></div>
时间: 2024-10-11 07:48:26