夢(mèng)幻之旅

          DEBUG - 天道酬勤

             :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            671 隨筆 :: 6 文章 :: 256 評(píng)論 :: 0 Trackbacks
          <%@ page language="java" pageEncoding="UTF-8"%>
          <html>
          <head>
           <title>定制個(gè)性化風(fēng)格</title>
           <link rel="stylesheet" type="text/css" href="/ext330/resources/css/ext-all.css" />
              <script type="text/javascript" src="/ext330/adapter/ext/ext-base.js"></script>
              <script type="text/javascript" src="/ext330/ext-all.js"></script>
              <script type="text/javascript" src="/myCookie.js"></script>
             
           <script type="text/javascript">
            Ext.ux.ThemeChange = Ext.extend(Ext.form.ComboBox,{
              editable : false,
                    displayField : 'theme',
                    valueField : 'css',
                    typeAhead : true,
                    mode : 'local',
                    value : '默認(rèn)',
                    readonly : true,
                    triggerAction : 'all',
                    selectOnFocus : true,
                    initComponent : function(){
                            var themes = [
                                            ['默認(rèn)', 'ext-all.css'],
                                            ['淺灰色', 'xtheme-gray.css']
                            ];
                            this.store = new Ext.data.SimpleStore({
                                    fields : ['theme', 'css'],
                                    data : themes
                            });
                    },
                    initEvents : function(){
                            this.on('collapse', function(){
                                    var name = this.getValue();
                                    setCookie("myThemeCss", name, '1h');
                                    Ext.util.CSS.swapStyleSheet('theme', '/ext330/resources/css/'+ name);
                            });
                    }
            });
            Ext.reg('xthemeChange', Ext.ux.ThemeChange);
            Ext.onReady(function(){
                    var myThemeCss = getCookieVal("myThemeCss");
                    alert(myThemeCss);
                    var themeList = new Ext.ux.ThemeChange();
                   if(myThemeCss != ""){
                           Ext.util.CSS.swapStyleSheet('theme', '/ext330/resources/css/' + myThemeCss);
                           themeList.setValue(myThemeCss);
                    }
            
                    //實(shí)例化一個(gè)可以改變風(fēng)格樣式的組件
                    var pan = new Ext.Panel({
                            title:'定制個(gè)性化風(fēng)格',
                            items: themeList,
                            height:200,
                            width:300
                    });
                    pan.render("hr_panel");
            });
            </script>
          </head>
          <body>
                  <table cellspacing="5" cellpadding="5"><tr><td><div id="hr_panel"></div></td></tr></table>
          </body>
          </html>
          posted on 2010-10-20 12:03 HUIKK 閱讀(578) 評(píng)論(0)  編輯  收藏 所屬分類: EXT
          主站蜘蛛池模板: 西乌珠穆沁旗| 蒙山县| 武威市| 桓台县| 大洼县| 蓬安县| 家居| 巴彦县| 邵阳市| 基隆市| 山阴县| 讷河市| 嘉定区| 逊克县| 始兴县| 县级市| 竹北市| 宝坻区| 孙吴县| 偏关县| 广宗县| 收藏| 揭西县| 南澳县| 巨鹿县| 彭州市| 海林市| 巫溪县| 乐昌市| 黑龙江省| 和政县| 遂川县| 叶城县| 常山县| 札达县| 台北市| 大连市| 镇江市| 巴彦县| 于都县| 分宜县|