js对象使用格式

var initEvent = {
    list:['editor'],
    editor:function () {
        var obj = $("[dataType = 'text']"),len = obj.size(),id,ue;

        for(var i = 0 ;i<len;i++)
        {
            id = obj.eq(i).find('textarea').attr('id');
            if(typeof id != 'undefined')
            {
                ue = new UE.ui.Editor();
                ue.render(id);
                //UE.getEditor(id).reset();
            }
        }

    },
    init:function () {
        for(var i in this.list)
        {
            if(typeof this.list[i] != 'undefined' && typeof this[this.list[i]] == 'function')
            {
                this[this.list[i]]();
            }
        }
    }

};
$(function () {
    initEvent.init();
})
原文地址:https://www.cnblogs.com/BeautyFuture/p/6224866.html