淡入背景色不适用于javascript

淡入背景色不适用于javascript,javascript,html,Javascript,Html,我尝试在javascript中使用背景色,使其从一种颜色变为白色(或任何颜色),但我的代码不起作用。Firebug中的错误表示this.countDown.bind不是函数。但是我已经将倒计时定义为一个函数,正如您在下面的代码中看到的那样。请有人告诉我哪里做错了。这是我的密码: var fadingObject = { yellowColor: function(val){ var r = 'ff', g = 'ff', b = val

我尝试在javascript中使用背景色,使其从一种颜色变为白色(或任何颜色),但我的代码不起作用。Firebug中的错误表示this.countDown.bind不是函数。但是我已经将倒计时定义为一个函数,正如您在下面的代码中看到的那样。请有人告诉我哪里做错了。这是我的密码:

var fadingObject = {
    yellowColor: function(val){
        var r = 'ff', 
        g = 'ff', 
        b = val.toString(16),
        newval = '#' + r + g + b;

        return newval;
    },
    fade: function(id, start, finish){
        this.start = start;
        this.count = this.start;
        this.finish = finish;
        this.id = id;

        this.countDown = function(){
            this.count += 30;

            if(this.count >= this.finish){
                document.getElementById(this.id).style.background = 'transparent';
                this.countDown = null;
                return;
            }

            document.getElementById(this.id).style.backgroundColor = this.yellowColor(this.count);

            setTimeout(this.countDown.bind(this), 100);
        }
    }
};
HTML(如果需要):


掌控一切,让写作再次变得有趣和快速。代码片段自动化


这是一个javascript函数。因此,您没有任何子对象(即称为bind的子对象)可向下钻取。我错过什么了吗

<div id="one">
  <p>Take control and make writing fun and fast again. Snippets automate...</p>
</div>