Chinaunix首页 | 论坛 | 博客
  • 博客访问: 105957
  • 博文数量: 36
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 330
  • 用 户 组: 普通用户
  • 注册时间: 2014-08-18 23:16
文章分类
文章存档

2016年(7)

2015年(20)

2014年(9)

我的朋友

分类: 架构设计与优化

2015-03-06 17:59:21

/*
选项卡
id                          easyui标签的ID
maxlength             设置选项卡最大个数
*/
jeasyui.Tabs = function (id, maxlength) {
    this.id = id;
    this.maxlength = maxlength;
    this.currTabCount = 1;
    //自动关闭选项卡函数
    this.autoCloseTab = function () {
        $('#' + this.id).tabs('close', 1);
    };
    //关闭指定选项卡函数
    this.CloseTab = function (title) {
        $('#' + this.id).tabs('close', title);
    };
    //关闭除选中外所有选项卡函数
    this.CloseAllTabExceptThis = function (title) {
        var alltabs = $('#' + this.id).tabs('tabs');
        var currtab = $('#' + this.id).tabs("getTab", title);
        var titlelist = new Array();
        var listcount = 0;
        for (var i = 0; i < alltabs.length; i++) {
            if (alltabs[i] != currtab && alltabs[i].panel('options').title != "首页") {
                titlelist[listcount] = alltabs[i].panel('options').title;
                listcount++;
            }
        }
        for (var j = 0; j < listcount; j++) {
            $('#' + this.id).tabs('close', titlelist[j]);
        }
    };
};
//添加一个选项卡
jeasyui.Tabs.prototype.addTab = function (titleName, url) {
    if (!this.exists(titleName)) {
        //var iframe = $('