案例:Extjs案例     状态:可编辑再运行    进入竖版
 运行结果 
AخA
 
1
<!DOCTYPE html>
2
<html>
3
   <head>
4
   <link href="//cdn.bootcss.com/extjs/6.2.0/classic/theme-classic/resources/theme-classic-all.css" rel="stylesheet" />
5
   <script type="text/javascript" src="//cdn.bootcss.com/extjs/6.2.0/ext-all.js"></script>
6
      <script type="text/javascript">
7
         Ext.onReady(function(){
8
            Ext.create('Ext.Button', {
9
               renderTo: Ext.getElementById('button1'),
10
               text: 'Button1',
11
               listeners: {
12
                  click: function() {
13
                     Ext.MessageBox.alert('Alert box', 'Button 1 is clicked');  
14
                  }
15
               }
16
            });
17
             Ext.create('Ext.Button', {
18
               renderTo: Ext.getElementById('button2'),
19
               text: 'Button2',
20
               listeners: {
21
                  click: function() {
22
                     Ext.MessageBox.alert('Alert box', 'Button 2 is clicked');  
23
                  }
24
               }
25
            });
26
             Ext.create('Ext.Button', {
27
               renderTo: Ext.getElementById('button3'),
28
               text: 'Button3',
29
               listeners: {
30
                  click: function() {
31
                     Ext.MessageBox.alert('Alert box', 'Button 3 is clicked');  
32
                  }
33
               }
34
            });
35
         });     
36
      </script>
37
   </head>
38
   <body> <p>Please click the button to see event listener:</p>
39
      <span id="button3"/>
40
      <span id="button2"/>
41
      <span id="button1"/>
42
   </body>
43
</html>