ExtJS Button简单应用

Ext.create("Ext.Button", {

               text: "click",    //文字
               renderTo: Ext.getBody(),    //页面展示
               height: 40,
               width: 100,
               style: { marginLeft: '100px' },   //样式

               //下拉效果
               arrowAlign: 'bottom',
               //下拉项
               menu: [
                       { text: 'Item 1' },
                       { text: 'Item 2' },
                       { text: 'Item 3' },
                       { text: 'Item 4' }
                    ],

               //添加事件侦听
               //具体事件:click toggle mouseover mouseout mouseshow menuhide menutriggerover menutriggerout
               listeners: {
                   click: function () {
                       //this == the button, as we are in the local scope
                       this.setText('I was clicked!');
                   },
                   mouseover: function () {
                       //set a new config which says we moused over, if not already set
                       if (!this.mousedOver) {
                           this.mousedOver = true;
                           alert('2');
                       }
                   }
               }

 

           })

posted @ 2012-02-21 12:02  高捍得  阅读(347)  评论(0编辑  收藏  举报