js,同意后,才可已点击注册按钮

js实现同意后,才可以点击注册

<!DOCTYPE html>
<html>
<head>
    <title>index</title>
</head>
<body>
<label><input type="checkbox" id="agree" />同意!</label>
<button id="register" disabled="true">注册</button>
</body>
<script type="text/javascript">
(function(){
var agree=document.getElementById("agree");
agree.onclick=function(){
    if(cb.checked==true){
        document.getElementById("register").disabled=false;
    }
    else{
        document.getElementById("register").disabled=true;
    }
}
})();
</script>
</body>
</html>
原文地址:https://www.cnblogs.com/quietxin/p/8759616.html