案例: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
            var button = Ext.create('Ext.Button', {
9
               renderTo: Ext.getElementById('helloWorldPanel'),
10
               text: 'My Button',
11
               listeners: {
12
                  myEvent: function(button) {
13
                     Ext.MessageBox.alert('Alert box', 'My custom event is called');
14
                  }
15
               }
16
            });
17
            Ext.defer(function() {
18
               button.fireEvent('myEvent');
19
            }, 5000);
20
         }); 
21
      </script> 
22
   </head>
23
   <body>
24
      <p> The event will be called after 5 seconds when the page is loaded. </p>
25
      <div id = 'helloWorldPanel' />   <!--  panel will be rendered here-- >
26
   </body>
27
</html>