Add a button to body : Body « Ext JS « JavaScript DHTML






Add a button to body

 

<html>
<head>
<title>Hello World Window</title>
<link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>

</head>
<body>
<script type="text/javascript">
Ext.onReady(function() {
    var win;
    var newWindow = function(btn) {
        if (! win) {
            win = new Ext.Window({
                 title    : "title",
                animateTarget : btn.el,
                html          : 'My first Window',
                closeAction   : 'hide',
                id            : 'myWin',
                height        : 200,
                width         : 300,
                constrain     : true
            });
        }
        win.show();
    }
    new Ext.Button({
        renderTo : Ext.getBody(),
        text     : 'Open my Window',
        style    : 'margin: 100px',
        handler  : newWindow
    });
});
</script> 
<div id='div1'>asdf</div>
</body>
</html>

   
  








Related examples in the same category

1.highlight body