1. 程式人生 > >3、主頁添加script代碼

3、主頁添加script代碼

else tab spa selected bsp exist get ebo tex

為Home控制器下的Index添加Scrip代碼,手動敲入script,按Tab鍵,頁面自動補齊<script></script>

技術分享圖片
 1 <script>
 2 
 3     //增加選項卡
 4     function addTab(subtitle, url) {
 5         if (!$("#mainTab").tabs(exists, subtitle)) {  //若選項卡不存在,生成新的選項卡
 6             var con = <iframe frameborder="0" scrolling="auto" style="width:99.5%; height:99%"  src="
+ url + "></iframe>; 7 $("#mainTab").tabs(add, { 8 title: subtitle, 9 content: con, 10 closable: true, 11 loadingMessage: 加載中...... 12 }); 13 } else { //若選項卡已存在,選擇該選項卡 14 $("
#mainTab").tabs(select, subtitle); 15 $("#tab_menu-tabrefresh").trigger("click"); 16 } 17 } 18 19 //刷新選項卡 20 function refreshTab() { 21 var index = $(#mainTab).tabs(getTabIndex, $(#mainTab).tabs(getSelected)); 22 if (index != -1) { 23 var
tab = $(#mainTab).tabs(getTab, index); 24 $(#mainTab).tabs(update, { 25 tab: tab, 26 options: { 27 selected: true 28 } 29 }); 30 } 31 } 32 33 //關閉選項卡 34 function closeTab() { 35 $(.tabs-inner span).each(function (i, n) { 36 var t = $(n).text(); 37 if (t != ‘‘) { 38 if (t != "我的主頁") { 39 $(#mainTab).tabs(close, t); 40 } 41 } 42 }); 43 } 44 45 </script>
Tab選項卡

3、主頁添加script代碼