<div data-options="region:‘center‘" > <div id="tab" class="easyui-tabs" fit="true"> <div title="主页"></div> </div> </div>
function f_addTab(name,tabId,title,url){ if ($("#tab").tabs(‘exists‘, tabId)) { $(‘#tab‘).tabs(‘select‘, tabId); // $(‘#‘+tabId).attr(‘src‘,url);//刷新 } else { $(‘#tab‘).tabs(‘add‘,{ id:tabId, title:title, content:‘<iframe name="‘+name+‘" src="‘+url+‘" frameborder="0" style="height:100%;width:100%;" "></iframe>‘, closable:true ,//tab显示关闭键 cache:true //设置缓存,如果为false,在每次选中所选的tab时,都会加载一次页面内容 }); } }
第二种,使用href:
function f_addHref(tabId,title,hrefUrl){ if ($("#tab").tabs(‘exists‘, tabId)) { $(‘#tab‘).tabs(‘select‘, tabId); $(‘#‘+tabId).attr(‘src‘,url);//刷新 } else { $(‘#tab‘).tabs(‘add‘,{ id:tabId, title:title, href:hrefUrl, closable:true , cache:true }); } }
第一种和第二种的区别:
原文:http://www.cnblogs.com/chickenbeer/p/5109921.html