日期:2014-05-17 浏览次数:20658 次
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Panel</title> <link type="text/css" rel="stylesheet" href="../../ext/resources/css/ext-all.css"> <style type="text/css"> .contain{ /* 设置背景 */ background:#000; /* 居中设置 */ margin:0 auto; width:500px; height:500px; /* 外层div相对定位 */ position:relative; } .center{ /* 居中设置 */ margin:0 auto; /* 内层div相对外层div绝对居中 */ position:absolute; /* 指定内层div的位置 */ top:150px; left:150px; } </style> <script type="text/javascript" src="../../ext/adapter/ext/ext-base.js"></script> <script type="text/javascript" src="../../ext/ext-all.js"></script> <script type="text/javascript"> Ext.onReady(function() { var _panel = new Ext.Panel({ frame:true, width:200, height:200, title:"面板" }); _panel.addButton({text: "确 定"}); _panel.addButton(new Ext.Button({ text:"new Button", minWidth:100 })); /* 动态创建元素 DomHelper.append */ _panel.applyToMarkup(Ext.DomHelper.append(Ext.getBody(),{ tag:"div", cls:"contain", cn:[{ tag:"div", cls:"center" }] }, true).child("div")); }); </script> </head> <body> </body> </html>