tabs 选项卡

<!--tabs 选项卡-->
<h1>tabs 选项卡</h1>
<!--tabs 选项卡:动态添加选项卡-->
<div style="margin-bottom:10px">
  <a href="#" class="easyui-linkbutton" onclick="addTabB('google','http://www.google.com')">google</a>
  <a href="#" class="easyui-linkbutton" onclick="addTabB('jquery','http://jquery.com/')">jquery</a>
  <a href="#" class="easyui-linkbutton" onclick="addTabB('easyui','http://jeasyui.com/')">easyui</a>
</div>

<!--tabs 选项卡定义-->

<div id='tabsId' class="easyui-tabs" style="width:500px;height:250px;">
  <div title="Tab1" style="padding:20px;display:none;">
    tab1
  </div>
  <div title="Tab2" data-options="closable:true" style="overflow:auto;padding:20px;display:none;">
    tab2
  </div>
  <div title="Tab3" data-options="iconCls:'icon-reload',closable:true" style="padding:20px;display:none;">
    tab3
  </div>
</div>

//动态添加选项卡方法
function addTab(title, url){
  if ($('#tt').tabs('exists', title)){
    $('#tt').tabs('select', title);
  } else {
    var content = '<iframe scrolling="auto" frameborder="0" src="'+url+'" style="width:100%;height:100%;"></iframe>';
    $('#tt').tabs('add',{
      title:title,
      content:content,
      closable:true
    });
  }
}

posted @ 2017-10-14 20:27  侠客夜莺  阅读(358)  评论(0编辑  收藏  举报