---
title: "轻松地进入Ext的世界--firefox debug"
author: "caizh2009"
date: "2009-05-18T02:21:00Z"
tags: ["EXT", "Firebug", "Firefox", "JavaScript", "浏览器"]
slug: "ext-firefox-debug"
draft: false
lastmod: "2009-05-18T02:21:00Z"
id: 413382
url: "https://caizh2009.iteye.com/blog/413382"
---

# Tutorial:Playing With Ext The Easy Way (Chinese)

### From Learn About the Ext JavaScript Library

Jump to: [navigation](http://extjs.com/learn/Tutorial:Playing_With_Ext_The_Easy_Way_%28Chinese%29#column-one), [search](http://extjs.com/learn/Tutorial:Playing_With_Ext_The_Easy_Way_%28Chinese%29#searchInput)

&lt;!-- start content --&gt;

**Summary:** Playing With Ext The Easy Way (Chinese) **Author:** [Patrick Donelan](http://patspam.com/ "http://patspam.com") (翻译：[Cloudream](http://www.5iya.com/blog "http://www.5iya.com/blog")) **Published:** 2007-10-12 **Ext Version:** 2.0 **Languages:** ![en.png](http://extjs.com/modules/i18n/flags/en.png)[English](http://extjs.com/learn/Tutorial:Playing_With_Ext_The_Easy_Way "Tutorial:Playing With Ext The Easy Way") ![de.png](http://extjs.com/modules/i18n/flags/de.png)[Deutsch](http://extjs.com/learn/Tutorial:Playing_With_Ext_The_Easy_Way_%28German%29 "Tutorial:Playing With Ext The Easy Way (German)") ![cn.png](http://extjs.com/modules/i18n/flags/cn.png)**Chinese** ![kr.png](http://extjs.com/modules/i18n/flags/kr.png)[Korean](http://extjs.com/learn/Tutorial:Playing_With_Ext_The_Easy_Way_%28Korean%29 "Tutorial:Playing With Ext The Easy Way (Korean)") ![jp.png](http://extjs.com/modules/i18n/flags/jp.png)[Japanese](http://extjs.com/learn/Tutorial:Playing_With_Ext_The_Easy_Way_%28Japanese%29 "Tutorial:Playing With Ext The Easy Way (Japanese)") ![es.png](http://extjs.com/modules/i18n/flags/es.png)[Spanish](http://extjs.com/learn/Tutorial:Playing_With_Ext_The_Easy_Way_%28Spanish%29 "Tutorial:Playing With Ext The Easy Way (Spanish)") ![tr.png](http://extjs.com/modules/i18n/flags/tr.png)[Turkish](http://extjs.com/learn/Tutorial:Playing_With_Ext_The_Easy_Way_%28Turkish%29 "Tutorial:Playing With Ext The Easy Way (Turkish)")

## Contents

\[[hide]()]

- [1 蹒跚学步](http://extjs.com/learn/Tutorial:Playing_With_Ext_The_Easy_Way_%28Chinese%29#.E8.B9.92.E8.B7.9A.E5.AD.A6.E6.AD.A5)
  
  - [1.1 第一步 - 入门](http://extjs.com/learn/Tutorial:Playing_With_Ext_The_Easy_Way_%28Chinese%29#.E7.AC.AC.E4.B8.80.E6.AD.A5_-_.E5.85.A5.E9.97.A8)
  - [1.2 第二步 - 起步](http://extjs.com/learn/Tutorial:Playing_With_Ext_The_Easy_Way_%28Chinese%29#.E7.AC.AC.E4.BA.8C.E6.AD.A5_-_.E8.B5.B7.E6.AD.A5)
- [2 牛刀小试](http://extjs.com/learn/Tutorial:Playing_With_Ext_The_Easy_Way_%28Chinese%29#.E7.89.9B.E5.88.80.E5.B0.8F.E8.AF.95)

&lt;script type="text/javascript"&gt; if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } &lt;/script&gt;[]()

### [![](http://extjs.com/learn/w/skins/extjs/page_edit.png)](http://extjs.com/learn/w/index.php?title=Tutorial%3APlaying_With_Ext_The_Easy_Way_%28Chinese%29&action=edit&section=1 "Edit section: 蹒跚学步") 蹒跚学步

[]()

#### [![](http://extjs.com/learn/w/skins/extjs/page_edit.png)](http://extjs.com/learn/w/index.php?title=Tutorial%3APlaying_With_Ext_The_Easy_Way_%28Chinese%29&action=edit&section=2 "Edit section: 第一步 - 入门") 第一步 - 入门

想必您已经听说过 Ext、浏览了[在线演示](http://extjs.com/learn/ "http://extjs.com/learn/")，并且尝试阅读[API文档](http://extjs.com/deploy/dev/docs/ "http://extjs.com/deploy/dev/docs/")。不过，面对复杂的API文档，您却不知如何下手？！

[]()

#### [![](http://extjs.com/learn/w/skins/extjs/page_edit.png)](http://extjs.com/learn/w/index.php?title=Tutorial%3APlaying_With_Ext_The_Easy_Way_%28Chinese%29&action=edit&section=3 "Edit section: 第二步 - 起步") 第二步 - 起步

通览过[API文档](http://extjs.com/deploy/dev/docs/ "http://extjs.com/deploy/dev/docs/")，并且找到了所要立刻尝试的功能，面对混杂的网页源代码，如何开始一个简单的测试页面？那么……

不论您的目标是什么，您都可以依照本文快速的开始使用Ext。不，不用搭建服务器，您所需要的仅仅是[Firefox浏览器和Firebug调试插件](http://extjs.com/learn/Manual:Resources#Firebug "Manual:Resources")。如果还没有安装，那么现在就是一个好机会。

[]()

### [![](http://extjs.com/learn/w/skins/extjs/page_edit.png)](http://extjs.com/learn/w/index.php?title=Tutorial%3APlaying_With_Ext_The_Easy_Way_%28Chinese%29&action=edit&section=4 "Edit section: 牛刀小试") 牛刀小试

- 打开[Ext API文档](http://extjs.com/deploy/dev/docs/ "http://extjs.com/deploy/dev/docs/")，您已经上路！
- 单击 F12 打开 Firebug 控制台。
- 如果您的 firebug 控制台处于单行模式（以 '&gt;&gt;&gt;' 开头），那么请单击右下角的红色上箭头以开启多行编辑模式。
- 输入以下代码，并敲击 Ctrl-Enter 来运行:

```
Ext.get(document.body).update('<div id="test"></div>');
```

上边这行代码的作用是将当前DOM body元素用一个ID为**test**的div元素替换。刚才那些API文档已经被删除，但 Ext 代码依旧生效，并且随时为您效劳。

现在，我们假设您希望简单的添加一个面板元素（Panel），但对Ext.Panel的API冗繁的说明无能为力。那么试着将这些代码添加到 firebug 的控制台中：

```
Ext.get(document.body).update('<div id="test"></div>');

new Ext.Panel({

renderTo: 'test',

width: '200px',

title: 'My Title',

html: 'My HTML content'

});
```

再次敲击 Ctrl-Enter 。嗨！您的面板元素已经诞生。

很好，不过如果修改一些选项呢？用下边的代码替换刚才的那些代码：

```
Ext.get(document.body).update('<div id="test"></div>');

new Ext.Panel({

renderTo: 'test',

width: '200px',

title: 'My Title',

html: 'My HTML content',

collapsible: true

});
```

敲击 Ctrl-Enter 。怎么样，一个可以伸缩的面板就配置好了。（注意面板右上角的小图标）

每次敲击 Ctrl-Enter ，第一行代码都会移除现有的内容，这样您就可以有一个干净的调试环境。这是一个简单的小技巧，十分方便您尝试各种配置选项。

您可以为**update()**函数添加所需要的 HTML 代码，无论多少。然后编写或多或少的 Javascript 来探索 Ext API。

还等什么？现在就去亲自实践 Ext Api 吧。

- [Ext Programmer's API Documentation](http://extjs.com/deploy/dev/docs/ "http://extjs.com/deploy/dev/docs/")
- [Ext User Forums](http://extjs.com/forum/ "http://extjs.com/forum/")

&lt;!-- Pre-expand include size: 1285 bytes Post-expand include size: 2423 bytes Template argument size: 1537 bytes Maximum: 2097152 bytes --&gt;

Retrieved from "[http://extjs.com/learn/Tutorial:Playing\_With\_Ext\_The\_Easy\_Way\_%28Chinese%29](http://extjs.com/learn/Tutorial:Playing_With_Ext_The_Easy_Way_%28Chinese%29)"

[Categories](http://extjs.com/learn/Special:Categories "Special:Categories"): [Tutorial](http://extjs.com/learn/Category:Tutorial "Category:Tutorial") | [Chinese](http://extjs.com/learn/w/index.php?title=Category%3AChinese&action=edit "Category:Chinese")

![](http://www.blogjava.net/caizh2009/aggbug/271249.html)

[小菜毛毛](http://www.blogjava.net/caizh2009/) 2009-05-18 10:21 [发表评论](http://www.blogjava.net/caizh2009/articles/271249.html#Feedback)