new Ext.Window({properties})

<!DOCTYPE html>
<html>
    <head>
        <link
            href="./ext-6.0.0-gpl/ext-6.0.0/build/classic/theme-classic/resources/theme-classic-all.css"
            rel="stylesheet"
        />
        <script src="./ext-6.0.0-gpl/ext-6.0.0/build/ext-all.js"></script>
        <script type="text/javascript">
            Ext.onReady(function () {
                win = new Ext.Window({
                  title: 'Email Window',
                  layout: 'form',
                  width: 400,
                  closeAction: 'close',
                  target: document.getElementById('formID'),
                  plain: true,
                  items: [{
                    xtype: 'textfield',
                    fieldLabel: 'To'
                  },{
                    xtype: 'textfield',
                    fieldLabel: 'CC'
                  },{
                    xtype: 'textfield',
                    fieldLabel: 'Subject'
                  },{
                    xtype: 'textarea',
                    fieldLabel: 'Email Message'
                  }],
                  buttons: [{
                    text: 'save draft',
                    handler: function () { Ext.Msg.alert('Save Draft', 'Draft saved successfully.') }
                  },{
                    text: 'send',
                    handler: function () { Ext.Msg.alert('Send', 'Email sent successfully.') }
                  },{
                    text: 'cancel',
                    handler: function () { win.close(); Ext.Msg.alert('Cancel', 'Email not sent.') }
                  }],
                  buttonAlign: 'center'
                })
                Ext.create('Ext.Button', {
                  renderTo: document.getElementById('formID'),
                  text: 'click me',
                  listeners: {
                    click: function () {
                      win.show()
                    }
                  }
                })
            });
        </script>
    </head>
    <body>
        <div id="formID"></div>
    </body>
</html>

运行结果:
image.png


零号
1 声望0 粉丝