ExtJS之Ext.getDom

时间:2024-03-14 20:30:51
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!DOCTYPE html>
<html>
<head>
    <title>ExtJs</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link rel="stylesheet" type="text/css" href="ExtJs/packages/ext-theme-crisp/build/resources/ext-theme-crisp-all.css">
        <script type="text/javascript" src="ExtJs/ext-all.js"></script>
        <script type="text/javascript" src="ExtJs/bootstrap.js"></script>
        <script type="text/javascript" src="ExtJs/packages/ext-theme-crisp/build/ext-theme-crisp.js"></script>
 
    <script type="text/javascript">
            Ext.onReady(function(){
        var panel = new Ext.Panel({
          title: 'SAMPLE',
          renderTo: 'sub1',
          id: 'panel1',
          width: '300px',
          html: "<div id='div1' property1='pro1' style='height:200px;padding:5px;font-size:11pt;font-family:Arial'>" +
            "实例化了一个id为panel1的panel组件</div>"
        });
      var comp = Ext.getDom('panel1');
      Ext.Msg.alert("notice","通过Ext.getDom取得的dom的id为"+comp.id +
        "<br>通过另一种方式取得panel的dom其id为:" + panel.el.dom.id);
      });
    </script>
</head>
<body>
<div id=sub1></div>
</body>
</html>

  ExtJS之Ext.getDom