来自:Zephyr.Net开发手册
var $tab = $('#tabs'); var currentTab = $tab.tabs('getSelected'); var titles = wrapper.getTabTitles($tab); switch (item.id) { case "refresh": var src = $(currentTab.panel('options').content).attr('src'); $tab.tabs('update', { tab: currentTab, options: { content: wrapper.createFrame(src) } }); break; case "close": var currtab_title = currentTab.panel('options').title; $tab.tabs('close', currtab_title); break; case "closeall": $.each(titles, function () { if (this != wrapper.settings.homeTabTitle) $tab.tabs('close', this); }); break; case "closeother": var currtab_title = currentTab.panel('options').title; $.each(titles, function () { if (this != currtab_title && this != wrapper.settings.homeTabTitle) $tab.tabs('close', this); }); break; case "closeright": var tabIndex = $tab.tabs('getTabIndex', currentTab); if (tabIndex == titles.length - 1) { alert('亲,后边没有啦 ^@^!!'); return false; } $.each(titles, function (i) { if (i > tabIndex && this != wrapper.settings.homeTabTitle) $tab.tabs('close', this); }); break; case "closeleft": var tabIndex = $tab.tabs('getTabIndex', currentTab); if (tabIndex == 1) { alert('亲,前边那个上头有人,咱惹不起哦。 ^@^!!'); return false; } $.each(titles, function (i) { if (i < tabIndex && this != wrapper.settings.homeTabTitle) $tab.tabs('close', this); }); break; case "exit": $('#closeMenu').menu('hide'); break; }
创建 iframe
createFrame = function (url) { return '<iframe scrolling="auto" frameborder="0" style="100%;height:100%;" src="' + url + '" ></iframe>'; }