倒数器启动后如何设置btn不能点击

$(document).ready(function(){

    function obj(id){

        var self = this;

        this.thisBtn = id;

        self.init();

    };

    obj.prototype.init = function(){

        var self = this;

        self.btnClick();

    };

    obj.prototype.btnClick = function(){

        var self =this;

        var btn = document.getElementById(this.thisBtn);

        var btnValue = btn.value;

        btn.onclick = function(){

            var num = 10;

            var time = setInterval(function(){

                if(num>1){

                    clear = false;

                    num--;

                    btn.value = num +"后获取";

                    self.type();

                }else{

                    clear = true;

                    clearInterval(time);

                    btn.value = "获取";

                }

            },1000);


        } 

    }

    var new_obj = new obj("obj")

});


vbibi
浏览 1197回答 1
1回答

qq_冲哥_0

<input     type = button>  有一个disabled 属性, 直接设置为true 就可以了
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript