中文字幕一区二区人妻电影,亚洲av无码一区二区乱子伦as ,亚洲精品无码永久在线观看,亚洲成aⅴ人片久青草影院按摩,亚洲黑人巨大videos

jEasyUI 動(dòng)態(tài)添加標(biāo)簽頁(yè)

通過使用 jQuery EasyUI 可以很容易地添加 Tabs。您只需要調(diào)用 'add' 方法即可。

在本教程中,我們將使用 iframe 動(dòng)態(tài)地添加顯示在一個(gè)頁(yè)面上的 Tabs。 當(dāng)點(diǎn)擊添加按鈕,一個(gè)新的 tab 將被添加。如果 tab 已經(jīng)存在,它將被激活。

步驟 1:創(chuàng)建 Tabs

????<div style="margin-bottom:10px">
????????<a href="#" class="easyui-linkbutton" onclick="addTab('google','http://www.google.com')">google</a>
????????<a href="#" class="easyui-linkbutton" onclick="addTab('jquery','http://jquery.com/')">jquery</a>
????????<a href="#" class="easyui-linkbutton" onclick="addTab('easyui','http://jeasyui.com/')">easyui</a>
????</div>
????<div id="tt" class="easyui-tabs" style="width:400px;height:250px;">
????????<div title="Home">
????????</div>
????</div>

這個(gè) html 代碼非常簡(jiǎn)單,我們創(chuàng)建了帶有一個(gè)名為 'Home' 的 tab 面板的 Tabs。請(qǐng)注意,我們不需要寫任何的 js 代碼。

步驟 2:實(shí)現(xiàn) 'addTab' 函數(shù)

????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
????????????});
????????}
????}

我們使用 'exists' 方法來判斷 tab 是否已經(jīng)存在,如果已存在則激活 tab。如果不存在則調(diào)用 'add' 方法來添加一個(gè)新的 tab 面板。