function GroupInfo(link, html, catalog){
    this._link = link;
    this._html = "<dl class=\"ob\">" + html + "</dl>";
    this._catalog = catalog;
    this._opt = 1;
    GroupInfo.prototype.setCatalog = function(catalog){
        this._catalog = catalog;
    };
    GroupInfo.prototype.getCatalog = function(){
        return this._catalog;
    };
    GroupInfo.prototype.getLink = function(){
        return this._link;
    };
    GroupInfo.prototype.getHtml = function(){
        return this._html;
    };
    GroupInfo.prototype.equla = function(groupInfo){
        return this._link == groupInfo.getLink();
    };
}上面是一个伪类,我经常在递归或者比较深的回调方法时后台会报没有方法错误,这是为什么。 js我没什么理论基础啊....

解决方案 »

  1.   


    function GroupInfo(link, html, catalog){
        this._link = link;
        this._html = " <dl class=\"ob\">" + html + " </dl>";
        this._catalog = catalog;
        this._opt = 1;

        GroupInfo.prototype.setCatalog = function(catalog){
            this._catalog = catalog;
        };
        GroupInfo.prototype.getCatalog = function(){
            return this._catalog;
        };
        GroupInfo.prototype.getLink = function(){
            return this._link;
        };
        GroupInfo.prototype.getHtml = function(){
            return this._html;
        };
        GroupInfo.prototype.equla = function(groupInfo){
            return this._link == groupInfo.getLink();
        };
    这样写就对了~··