﻿<?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博客-yunshichen-随笔分类-Ext2</title><link>http://www.cnitblog.com/yunshichen/category/8192.html</link><description>我相信人生是值得活的,尽管人在一生中必须遭受痛苦,卑劣,残酷,不幸和死亡的折磨,我依然深信如此.但我认为人生不一定要有意义,只是对一些人而言,他们可以使人生有意义.  ---J 赫胥黎</description><language>zh-cn</language><lastBuildDate>Mon, 26 Sep 2011 14:16:32 GMT</lastBuildDate><pubDate>Mon, 26 Sep 2011 14:16:32 GMT</pubDate><ttl>60</ttl><item><title>Ext2.2 教程二:MessageBox例子</title><link>http://www.cnitblog.com/yunshichen/archive/2009/04/15/56387.html</link><dc:creator>Chenyunshi</dc:creator><author>Chenyunshi</author><pubDate>Wed, 15 Apr 2009 03:54:00 GMT</pubDate><guid>http://www.cnitblog.com/yunshichen/archive/2009/04/15/56387.html</guid><wfw:comment>http://www.cnitblog.com/yunshichen/comments/56387.html</wfw:comment><comments>http://www.cnitblog.com/yunshichen/archive/2009/04/15/56387.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yunshichen/comments/commentRss/56387.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yunshichen/services/trackbacks/56387.html</trackback:ping><description><![CDATA[改写自下载包里自带的例子.<br /><br />jsp:<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">&lt;%</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">@ page language</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">java</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> contentType</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">text/html; charset=UTF-8</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">%&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">jsp:include </span><span style="color: rgb(255, 0, 0);">page</span><span style="color: rgb(0, 0, 255);">="/jsp/globalConfig.jsp"</span><span style="color: rgb(0, 0, 255);">&gt;&lt;/</span><span style="color: rgb(128, 0, 0);">jsp:include</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">html</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">head</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">title</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">MessageBox Samples</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">title</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">script </span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="text/javascript"</span><span style="color: rgb(255, 0, 0);"> src</span><span style="color: rgb(0, 0, 255);">="js/mbsample.js"</span><span style="color: rgb(0, 0, 255);">&gt;&lt;/</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">style </span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="text/css"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="background-color: rgb(245, 245, 245); color: rgb(128, 0, 0);"><br />    .x-window-dlg .ext-mb-download </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">{</span><span style="background-color: rgb(245, 245, 245); color: rgb(255, 0, 0);"><br />        background</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">:</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">transparent url(images/download.gif) no-repeat top left</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">;</span><span style="background-color: rgb(245, 245, 245); color: rgb(255, 0, 0);"><br />        height</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">:</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">46px</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">;</span><span style="background-color: rgb(245, 245, 245); color: rgb(255, 0, 0);"><br />    </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">}</span><span style="background-color: rgb(245, 245, 245); color: rgb(128, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">style</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">head</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">h1</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">MessageBox 对话框</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">h1</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">p</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">The example shows how to use the MessageBox class. Some of the buttons have animations, some are normal.</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">p</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">p</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">The js is not minified so it is readable. See </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">a </span><span style="color: rgb(255, 0, 0);">href</span><span style="color: rgb(0, 0, 255);">="js/mbsample.js"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Message-sample..js</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">a</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">p</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">p</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">b</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Confirm</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">b</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">br </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    Standard Yes/No dialog.<br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">button </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="mb1"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Show</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">button</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">p</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">p</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">b</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Prompt</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">b</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">br </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    Standard prompt dialog.<br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">button </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="mb2"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Show</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">button</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">p</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">p</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">b</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Multi-line Prompt</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">b</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">br </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    A multi-line prompt dialog.<br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">button </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="mb3"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Show</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">button</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">p</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">p</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">b</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Yes/No/Cancel</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">b</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">br </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    Standard Yes/No/Cancel dialog.<br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">button </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="mb4"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Show</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">button</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">p</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">p</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">b</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Progress Dialog</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">b</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">br </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    Dialog with measured progress bar.<br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">button </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="mb6"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Show</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">button</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">p</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">p</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">b</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Wait Dialog</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">b</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">br </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    Dialog with indefinite progress bar and custom icon (will close after 8 sec).<br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">button </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="mb7"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Show</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">button</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">p</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">p</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">b</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Alert</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">b</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">br </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    Standard alert message dialog.<br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">button </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="mb8"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Show</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">button</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">p</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">p</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">b</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Icons</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">b</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">br </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    Standard alert with optional icon.<br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">select </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="icons"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">option </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="error"</span><span style="color: rgb(255, 0, 0);"> selected</span><span style="color: rgb(0, 0, 255);">="selected"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Error</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">option</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">option </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="info"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Informational</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">option</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">option </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="question"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Question</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">option</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">option </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="warning"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Warning</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">option</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">select</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">button </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="mb9"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Show</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">button</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">p</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">html</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span></div><br />mbsample.js:<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 0);">/*</span><span style="color: rgb(0, 128, 0);"><br /> * Ext JS Library 2.2.1<br /> * Copyright(c) 2006-2009, Ext JS, LLC.<br /> * licensing@extjs.com<br /> * <br /> * http://extjs.com/license<br /> </span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br /><br />Ext.onReady(</span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);">(){<br />    Ext.get('mb1').on('click', </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);">(e){<br />        Ext.MessageBox.confirm('Confirm', 'Are you sure you want to </span><span style="color: rgb(0, 0, 255);">do</span><span style="color: rgb(0, 0, 0);"> that</span><span style="color: rgb(0, 0, 0);">?</span><span style="color: rgb(0, 0, 0);">', showResult);<br />    });<br /><br />    Ext.get('mb2').on('click', </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);">(e){<br />        Ext.MessageBox.prompt('Name', 'Please enter your name:', showResultText);<br />    });<br /><br />    Ext.get('mb3').on('click', </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);">(e){<br />        Ext.MessageBox.show({<br />           title: 'Address',<br />           msg: 'Please enter your address:',<br />           width:</span><span style="color: rgb(0, 0, 0);">300</span><span style="color: rgb(0, 0, 0);">,<br />           buttons: Ext.MessageBox.OKCANCEL,<br />           multiline: </span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">,<br />           fn: showResultText,<br />           animEl: 'mb3'<br />       });<br />    });<br /><br />    Ext.get('mb4').on('click', </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);">(e){<br />        Ext.MessageBox.show({<br />           title:'Save Changes</span><span style="color: rgb(0, 0, 0);">?</span><span style="color: rgb(0, 0, 0);">',<br />           msg: 'You are closing a tab that has unsaved changes. </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">br </span><span style="color: rgb(0, 0, 0);">/&gt;</span><span style="color: rgb(0, 0, 0);">Would you like to save your changes</span><span style="color: rgb(0, 0, 0);">?</span><span style="color: rgb(0, 0, 0);">',<br />           buttons: Ext.MessageBox.YESNOCANCEL,<br />           fn: showResult,<br />           animEl: 'mb4',<br />           icon: Ext.MessageBox.QUESTION<br />       });<br />    });<br /><br />    Ext.get('mb6').on('click', </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);">(){<br />        Ext.MessageBox.show({<br />           title: 'Please wait',<br />           msg: 'Loading items<img src="http://www.cnitblog.com/images/dot.gif" />',<br />           progressText: 'Initializing<img src="http://www.cnitblog.com/images/dot.gif" />',<br />           width:</span><span style="color: rgb(0, 0, 0);">300</span><span style="color: rgb(0, 0, 0);">,<br />           progress:</span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">,<br />           closable:</span><span style="color: rgb(0, 0, 255);">false</span><span style="color: rgb(0, 0, 0);">,<br />           animEl: 'mb6'<br />       });<br /><br />       </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> this hideous block creates the bogus progress</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">       </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> f </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);">(v){<br />            </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);">(){<br />                </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(v </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">12</span><span style="color: rgb(0, 0, 0);">){<br />                    Ext.MessageBox.hide();<br />                    Ext.example.msg('Done', 'Your fake items were loaded</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">');<br />                }</span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);">{<br />                    </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> i </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> v</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">11</span><span style="color: rgb(0, 0, 0);">;<br />                    Ext.MessageBox.updateProgress(i, Math.round(</span><span style="color: rgb(0, 0, 0);">100</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">i)</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">%</span><span style="color: rgb(0, 0, 0);"> completed');<br />                }<br />           };<br />       };<br />       </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> i </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">; i </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">13</span><span style="color: rgb(0, 0, 0);">; i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">){<br />           setTimeout(f(i), i</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">500</span><span style="color: rgb(0, 0, 0);">);<br />       }<br />    });<br /><br />    Ext.get('mb7').on('click', </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);">(){<br />        Ext.MessageBox.show({<br />           msg: 'Saving your data, please wait<img src="http://www.cnitblog.com/images/dot.gif" />',<br />           progressText: 'Saving<img src="http://www.cnitblog.com/images/dot.gif" />',<br />           width:</span><span style="color: rgb(0, 0, 0);">300</span><span style="color: rgb(0, 0, 0);">,<br />           wait:</span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">,<br />           waitConfig: {interval:</span><span style="color: rgb(0, 0, 0);">200</span><span style="color: rgb(0, 0, 0);">},<br />           icon:'ext</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">mb</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">download', </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">custom class in msg-box.html</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">           animEl: 'mb7'<br />       });<br />        setTimeout(</span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);">(){<br />            </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">This simulates a long-running operation like a database save or XHR call.</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">In real code, this would be in a callback function.</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">            Ext.MessageBox.hide();<br />            </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">Ext.example.msg('Done', 'Your fake data was saved!');</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">        }, </span><span style="color: rgb(0, 0, 0);">8000</span><span style="color: rgb(0, 0, 0);">);<br />    });<br /><br />    Ext.get('mb8').on('click', </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);">(){<br />        Ext.MessageBox.alert('Status', 'Changes saved successfully.', showResult);<br />    });<br /><br />    </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">Add these values dynamically so they aren't hard-coded in the html</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">    Ext.fly('info').dom.value </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> Ext.MessageBox.INFO;<br />    Ext.fly('question').dom.value </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> Ext.MessageBox.QUESTION;<br />    Ext.fly('warning').dom.value </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> Ext.MessageBox.WARNING;<br />    Ext.fly('error').dom.value </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> Ext.MessageBox.ERROR;<br /><br />    Ext.get('mb9').on('click', </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);">(){<br />        Ext.MessageBox.show({<br />           title: 'Icon Support',<br />           msg: 'Here is a message </span><span style="color: rgb(0, 0, 255);">with</span><span style="color: rgb(0, 0, 0);"> an icon</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">',<br />           buttons: Ext.MessageBox.OK,<br />           animEl: 'mb9',<br />           fn: showResult,<br />           icon: Ext.get('icons').dom.value<br />       });<br />    });<br /><br />    </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> showResult(btn){<br />        </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">Ext.example.msg('Button Click', 'You clicked the {0} button', btn);</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">    };<br /><br />    </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> showResultText(btn, text){<br />        </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">Ext.example.msg('Button Click', 'You clicked the {0} button and entered the text "{1}".', btn, text);</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">    };<br />});</span></div><br /><br /><br /><img src ="http://www.cnitblog.com/yunshichen/aggbug/56387.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yunshichen/" target="_blank">Chenyunshi</a> 2009-04-15 11:54 <a href="http://www.cnitblog.com/yunshichen/archive/2009/04/15/56387.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Ext2.2 教程一:预备走</title><link>http://www.cnitblog.com/yunshichen/archive/2009/04/15/56002.html</link><dc:creator>Chenyunshi</dc:creator><author>Chenyunshi</author><pubDate>Wed, 15 Apr 2009 02:08:00 GMT</pubDate><guid>http://www.cnitblog.com/yunshichen/archive/2009/04/15/56002.html</guid><wfw:comment>http://www.cnitblog.com/yunshichen/comments/56002.html</wfw:comment><comments>http://www.cnitblog.com/yunshichen/archive/2009/04/15/56002.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yunshichen/comments/commentRss/56002.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yunshichen/services/trackbacks/56002.html</trackback:ping><description><![CDATA[
		<br />
		<h3>
				<b>
						<font color="#009900">一 简介</font>
				</b>
		</h3>Ext 是目前最火爆的javascript框架. 原名yui-ext,是yahoo yui的补充, 后来另起炉灶,名字也更改为ExtJs.最新版本是2.2.1,你可以从这里下载:<a target="_blank" title="Ext2 下载" href="http://extjs.com/products/extjs/download.php?dl=extjs221">http://extjs.com/products/extjs/download.php?dl=extjs221</a><br /><br />YUI和Ext各有优缺点. 论开发的灵活度和性能,YUI更好. 论集成功能之多和界面漂亮,Ext更胜一筹.如果你是一个纯粹的开发人员,美工水平一般,那么用ExtJs来开发网站实在再好不过,你可以借助ExtJs自身类库实现许多很酷很炫的效果.<br /><br /><h3><b><font><b><font color="#009900">二 起步</font></b></font></b></h3>和YUI的大气不同,Ext是想在市场上赚点银子的.所以Ext的官方文档/资源相比YUI来说较为缺乏,入门不易.如果想要学习Ext,建议从以下几步着手:<br /><ul><li>查看Ext例子.下载完Ext后打开下载包,里面的examples目录有许多示范例子,尽自己能力改写这些例子,就能更快掌握Ext</li><li>查看api文档.在下载包的docs目录里有api文档可供查看.</li><li>借助firebug阅读源码.源码在下载包的source目录里.</li><li>安装spket eclipse插件.这样在eclipse里写js时就可以有code assistant功能.在这个视频里你可以看到这个功能是多么的酷:<a href="http://www.spket.com/demos/js.html" target="_blank">http://www.spket.com/demos/js.<wbr>html</wbr></a>  参考这篇文章进行安装:<a target="_blank" title="在spket里如何安装Ext2" href="http://www.blogjava.net/H-bomb/archive/2008/02/02/179051.html">http://www.blogjava.net/H-bomb/archive/2008/02/02/179051.html<br /></a></li><li>多动手,多总结.<br /></li></ul><h3><b><font><b><font><b><font><b><font color="#009900">三 实例的代码结构</font></b></font></b></font></b></font></b></h3>教程的源程序按照jsp的war格式进行组织,目录结构如下:<br /><br /><img src="http://www.cnitblog.com/images/cnitblog_com/yunshichen/2009-04-15-100356_346x551_scrot.png" alt="2009-04-15-100356_346x551_scrot.png" width="346" border="0" height="551" /><br /><br />globalConfig.jsp 的内容:<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);"><br /></span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">&lt;%</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">--</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> Ext config . </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">--</span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">%&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">link </span><span style="color: rgb(255, 0, 0);">rel</span><span style="color: rgb(0, 0, 255);">="stylesheet"</span><span style="color: rgb(255, 0, 0);"> type</span><span style="color: rgb(0, 0, 255);">="text/css"</span><span style="color: rgb(255, 0, 0);"> href</span><span style="color: rgb(0, 0, 255);">="&lt;%=request.getContextPath()%&gt;/js/ext-2.2.1/resources/css/ext-all.css"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">script </span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="text/javascript"</span><span style="color: rgb(255, 0, 0);"> src</span><span style="color: rgb(0, 0, 255);">="&lt;%=request.getContextPath()%&gt;/js/ext-2.2.1/adapter/ext/ext-base.js"</span><span style="color: rgb(0, 0, 255);">&gt;&lt;/</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">script </span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="text/javascript"</span><span style="color: rgb(255, 0, 0);"> src</span><span style="color: rgb(0, 0, 255);">="&lt;%=request.getContextPath()%&gt;/js/ext-2.2.1/ext-all.js"</span><span style="color: rgb(0, 0, 255);">&gt;&lt;/</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span></div><br /><br /><br /><img src ="http://www.cnitblog.com/yunshichen/aggbug/56002.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yunshichen/" target="_blank">Chenyunshi</a> 2009-04-15 10:08 <a href="http://www.cnitblog.com/yunshichen/archive/2009/04/15/56002.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>