ext 得到 j已定义id的元素

用Ext.getCmp(‘')即可得到进行操作。

 

例如:

 

  1.  var test=new Ext.Panel({        
  2.   
  3.               renderTo:"hello-dialog",  
  4.   
  5.               id:"hello",  
  6.   
  7.               title:"面板头部header",         
  8.   
  9.               width:300,      
  10.   
  11.               height:200,         
  12.   
  13.               html:'<h1>面板主区域</h1>',        
  14.   
  15.               tbar:[{text:'顶部工具栏topToolbar'}],         
  16.   
  17.               bbar:[{text:'底部工具栏bottomToolbar'}],      
  18.   
  19.               buttons:[{text:"按钮位于footer"}]         
  20.   
  21.            });  

用 var test =Ext.getCmp(‘ hello'); 
    alert(test.id);
    输出 hello

你可能感兴趣的:(ext,J#)