---
title: "ext  得到 j已定义id的元素"
author: "wangleide414"
date: "2009-11-15T20:33:04Z"
tags: []
categories: ["Web前端"]
slug: "ext-j-id"
draft: false
lastmod: "2012-08-01T11:27:44Z"
id: 517701
url: "https://wangleide414.iteye.com/blog/517701"
---

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

 

例如：

 

01. var test=new Ext.Panel({
02. renderTo:"hello-dialog",
03. id:"hello",
04. title:"面板头部header",
05. width:300,
06. height:200,
07. html:'&lt;h1&gt;面板主区域&lt;/h1&gt;',
08. tbar:\[{text:'顶部工具栏topToolbar'}],
09. bbar:\[{text:'底部工具栏bottomToolbar'}],
10. buttons:\[{text:"按钮位于footer"}]
11. });

用 var test =Ext.getCmp(‘hello'); 

    alert(test.id);

    输出 hello