夢幻之旅

          DEBUG - 天道酬勤

             :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            671 隨筆 :: 6 文章 :: 256 評論 :: 0 Trackbacks
          <%@ page language="java" pageEncoding="UTF-8"%>
          <html>
          <head>
           <title>定制個性化風格</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 : '默認',
                    readonly : true,
                    triggerAction : 'all',
                    selectOnFocus : true,
                    initComponent : function(){
                            var themes = [
                                            ['默認', '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);
                    }
            
                    //實例化一個可以改變風格樣式的組件
                    var pan = new Ext.Panel({
                            title:'定制個性化風格',
                            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) 評論(0)  編輯  收藏 所屬分類: EXT
          主站蜘蛛池模板: 和林格尔县| 海南省| 卫辉市| 永仁县| 酉阳| 罗平县| 怀柔区| 上蔡县| 巩留县| 虎林市| 龙陵县| 中宁县| 乌兰浩特市| 会宁县| 长治县| 宁津县| 双峰县| 安乡县| 江川县| 襄城县| 宜良县| 石屏县| 师宗县| 樟树市| 怀柔区| 个旧市| 邹平县| 偏关县| 伽师县| 石门县| 抚远县| 合作市| 万年县| 富川| 芜湖市| 建德市| 永宁县| 桦川县| 胶州市| 桐柏县| 定陶县|