﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-风花雪月-随笔分类-ExtJs学习</title><link>http://www.cnitblog.com/conish/category/8113.html</link><description /><language>zh-cn</language><lastBuildDate>Wed, 28 Sep 2011 14:29:35 GMT</lastBuildDate><pubDate>Wed, 28 Sep 2011 14:29:35 GMT</pubDate><ttl>60</ttl><item><title>ExtJs初次接触</title><link>http://www.cnitblog.com/conish/archive/2009/03/23/55679.html</link><dc:creator>风花雪月</dc:creator><author>风花雪月</author><pubDate>Mon, 23 Mar 2009 15:46:00 GMT</pubDate><guid>http://www.cnitblog.com/conish/archive/2009/03/23/55679.html</guid><wfw:comment>http://www.cnitblog.com/conish/comments/55679.html</wfw:comment><comments>http://www.cnitblog.com/conish/archive/2009/03/23/55679.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/conish/comments/commentRss/55679.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/conish/services/trackbacks/55679.html</trackback:ping><description><![CDATA[1.先去<a href="http://www.extjs.com/download" target=_top><u><font color=#0000ff>http://www.extjs.com/download</font></u></a>下载zip格式的发布包<br>2.随便解压缩到什么目录下，不管目录名是什么，最后应该看到里边是这样的目录结构（我用的是Aptana这个软件，也可以用Myeclipse这个软件）。&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>3.现在我们利用它的目录结构，写一个helloworld例子
<p>进入上图中的examples目录，新建一个helloworld目录，helloworld目录下新建一个helloworld.html文件，将下列内容复制进index.html文件中。</p>
<pre class=programlisting>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "<a href="http://www.w3.org/TR/html4/strict.dtd">http://www.w3.org/TR/html4/strict.dtd</a>"&gt;<br>&lt;html&gt;<br>&nbsp;&nbsp;&nbsp; &lt;head&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;title&gt;第一个EestJs程序&lt;/title&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;script type="text/javascript" src="../../adapter/ext/ext-base.js"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/script&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;script type="text/javascript" src="../../ext-all.js"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/script&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;script type="text/javascript" src="../examples.js"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/script&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;script&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ext.onReady(function()<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;Ext.MessageBox.alert("hello world!");<br>&nbsp;&nbsp;&nbsp;});<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/script&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/head&gt;<br>&nbsp;&nbsp;&nbsp; &lt;body&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/body&gt;<br>&lt;/html&gt;<br>4.&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "<a href="http://www.w3.org/TR/html4/strict.dtd">http://www.w3.org/TR/html4/strict.dtd</a>"&gt;<br>&lt;html&gt;<br>&nbsp;&nbsp;&nbsp; &lt;head&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;title&gt;第一个EestJs程序&lt;/title&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;script type="text/javascript" src="../../adapter/ext/ext-base.js"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/script&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;script type="text/javascript" src="../../ext-all.js"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/script&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;script type="text/javascript" src="../examples.js"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/script&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;script&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ext.onReady(function()<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;Ext.MessageBox.alert("hello world!");<br>&nbsp;&nbsp;&nbsp;});<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/script&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/head&gt;<br>&nbsp;&nbsp;&nbsp; &lt;body&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/body&gt;<br>&lt;/html&gt;<br>4.双击helloworld.html打开页面</pre>
<pre class=programlisting>5.剖析</pre>
<pre>想把ext放入自己的项目，需要自己整理一下，因为发布包里的东西并非都是必要的，比如文档，比如例子，比如源代码。</pre>
<p>必要的最小集合是这样：ext-all.js，adapter/ext/ext-base.js，build/locale/ext-lang-zh_CN.js和整个resources目录。</p>
<p><br>1.&nbsp;&nbsp;&nbsp; &nbsp;ext-all.js，adapter/ext/ext-base.js就包含了ext的所有功能，所有的js脚本都在这里了。</p>
<p><font face="Courier New">2. build/locale/ext-lang-zh_CN.js是中文翻译。<br><br>3. resources目录下是css样式表和图片。</font> </p>
<p class=orderedlist>&nbsp;自己的项目里只需要包含这些东西，就可以使用ext了。使用时，在页面中导入：</p>
<pre class=programlisting>&lt;link rel="stylesheet" type="text/css" href="${放置ext的目录}/resources/css/ext-all.css" /&gt;
&lt;script type="text/javascript" src="${放置ext的目录}/ext-base.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="${放置ext的目录}/ext-all.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="${放置ext的目录}/ext-lang-zh_CN.js"&gt;&lt;/script&gt;
</pre>
<p>请注意js脚本的导入顺序，其他的就可以自由发挥了。</p>
<img src ="http://www.cnitblog.com/conish/aggbug/55679.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/conish/" target="_blank">风花雪月</a> 2009-03-23 23:46 <a href="http://www.cnitblog.com/conish/archive/2009/03/23/55679.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>