案例:Extjs案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
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
            });
12
13
            // This way we can attach event to the button after the button is created.
14
            button.on('click', function() {
15
               Ext.MessageBox.alert('Alert box', 'Button is clicked');
16
            });
17
         });
18
      </script> 
19
   </head>
20
   <body>
21
      <p> Please click the button to see event listener </p>
22
      <div id = 'helloWorldPanel' />   <!--  panel will be rendered here-- >
23
   </body>
24
</html>