﻿<?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>PHP博客-为了忘却的纪念-随笔分类-ajax</title><link>http://www.phpweblog.net/fuyongjie/category/503.html</link><description>言己及众</description><language>zh-cn</language><lastBuildDate>Thu, 22 May 2008 13:11:20 GMT</lastBuildDate><pubDate>Thu, 22 May 2008 13:11:20 GMT</pubDate><ttl>60</ttl><item><title>AJAX中同时发送多个请求XMLHttpRequest对象处理方法</title><link>http://www.phpweblog.net/fuyongjie/archive/2008/05/21/3657.html</link><dc:creator>bestmost</dc:creator><author>bestmost</author><pubDate>Wed, 21 May 2008 08:06:00 GMT</pubDate><guid>http://www.phpweblog.net/fuyongjie/archive/2008/05/21/3657.html</guid><wfw:comment>http://www.phpweblog.net/fuyongjie/comments/3657.html</wfw:comment><comments>http://www.phpweblog.net/fuyongjie/archive/2008/05/21/3657.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.phpweblog.net/fuyongjie/comments/commentRss/3657.html</wfw:commentRss><trackback:ping>http://www.phpweblog.net/fuyongjie/services/trackbacks/3657.html</trackback:ping><description><![CDATA[<p>在ajax应用中，通常一个页面要同时发送多个请求，如果只有一个XMLHttpRequest对象，前面的请求还未完成，后面的就会把前面的覆盖 掉，如果每次都创建一个新的XMLHttpRequest对象，也会造成浪费。解决的办法就是创建一个XMLHttpRequset的对象池，如果池里有 空闲的对象，则使用此对象，否则将创建一个新的对象。</p>
<p>下面是我最近写的一个简单的类：<br><font color=#ff8000>*&nbsp;XMLHttpRequest&nbsp;Object&nbsp;Pool<br>&nbsp;*<br>&nbsp;*&nbsp;@author&nbsp;&nbsp;&nbsp;&nbsp;legend&nbsp;&lt;legendsky@hotmail.com&gt;<br>&nbsp;*&nbsp;@link&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;http://www.ugia.cn/?p=85<br>&nbsp;*&nbsp;@Copyright&nbsp;www.ugia.cn<br>&nbsp;*/&nbsp;<br></font><span class=php_007700><font color=#007700>var&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>XMLHttp&nbsp;</font></span><span class=php_007700><font color=#007700>=&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>_objPool</font></span><span class=php_007700><font color=#007700>:&nbsp;[],<br>&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>_getInstance</font></span><span class=php_007700><font color=#007700>:&nbsp;function&nbsp;()<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(var&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>i&nbsp;</font></span><span class=php_007700><font color=#007700>=&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>0</font></span><span class=php_007700><font color=#007700>;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>i&nbsp;</font></span><span class=php_007700><font color=#007700>&lt;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>this</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>_objPool</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>length</font></span><span class=php_007700><font color=#007700>;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>i&nbsp;</font></span><span class=php_007700><font color=#007700>++)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</font></span><span class=php_0000BB><font color=#0000bb>this</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>_objPool</font></span><span class=php_007700><font color=#007700>[</font></span><span class=php_0000BB><font color=#0000bb>i</font></span><span class=php_007700><font color=#007700>].</font></span><span class=php_0000BB><font color=#0000bb>readyState&nbsp;</font></span><span class=php_007700><font color=#007700>==&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>0&nbsp;</font></span><span class=php_007700><font color=#007700>||&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>this</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>_objPool</font></span><span class=php_007700><font color=#007700>[</font></span><span class=php_0000BB><font color=#0000bb>i</font></span><span class=php_007700><font color=#007700>].</font></span><span class=php_0000BB><font color=#0000bb>readyState&nbsp;</font></span><span class=php_007700><font color=#007700>==&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>4</font></span><span class=php_007700><font color=#007700>)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>this</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>_objPool</font></span><span class=php_007700><font color=#007700>[</font></span><span class=php_0000BB><font color=#0000bb>i</font></span><span class=php_007700><font color=#007700>];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_FF8000><font color=#ff8000>//&nbsp;IE5中不支持push方法<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>this</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>_objPool</font></span><span class=php_007700><font color=#007700>[</font></span><span class=php_0000BB><font color=#0000bb>this</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>_objPool</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>length</font></span><span class=php_007700><font color=#007700>]&nbsp;=&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>this</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>_createObj</font></span><span class=php_007700><font color=#007700>();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>this</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>_objPool</font></span><span class=php_007700><font color=#007700>[</font></span><span class=php_0000BB><font color=#0000bb>this</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>_objPool</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>length&nbsp;</font></span><span class=php_007700><font color=#007700>-&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>1</font></span><span class=php_007700><font color=#007700>];<br>&nbsp;&nbsp;&nbsp;&nbsp;},<br>&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>_createObj</font></span><span class=php_007700><font color=#007700>:&nbsp;function&nbsp;()<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</font></span><span class=php_0000BB><font color=#0000bb>window</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>XMLHttpRequest</font></span><span class=php_007700><font color=#007700>)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>objXMLHttp&nbsp;</font></span><span class=php_007700><font color=#007700>=&nbsp;new&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>XMLHttpRequest</font></span><span class=php_007700><font color=#007700>();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>MSXML&nbsp;</font></span><span class=php_007700><font color=#007700>=&nbsp;[</font></span><span class=php_DD0000><font color=#dd0000>'MSXML2.XMLHTTP.5.0'</font></span><span class=php_007700><font color=#007700>,&nbsp;</font></span><span class=php_DD0000><font color=#dd0000>'MSXML2.XMLHTTP.4.0'</font></span><span class=php_007700><font color=#007700>,&nbsp;</font></span><span class=php_DD0000><font color=#dd0000>'MSXML2.XMLHTTP.3.0'</font></span><span class=php_007700><font color=#007700>,&nbsp;</font></span><span class=php_DD0000><font color=#dd0000>'MSXML2.XMLHTTP'</font></span><span class=php_007700><font color=#007700>,&nbsp;</font></span><span class=php_DD0000><font color=#dd0000>'Microsoft.XMLHTTP'</font></span><span class=php_007700><font color=#007700>];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(var&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>n&nbsp;</font></span><span class=php_007700><font color=#007700>=&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>0</font></span><span class=php_007700><font color=#007700>;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>n&nbsp;</font></span><span class=php_007700><font color=#007700>&lt;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>MSXML</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>length</font></span><span class=php_007700><font color=#007700>;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>n&nbsp;</font></span><span class=php_007700><font color=#007700>++)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>try<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_007700><font color=#007700>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>objXMLHttp&nbsp;</font></span><span class=php_007700><font color=#007700>=&nbsp;new&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>ActiveXObject</font></span><span class=php_007700><font color=#007700>(</font></span><span class=php_0000BB><font color=#0000bb>MSXML</font></span><span class=php_007700><font color=#007700>[</font></span><span class=php_0000BB><font color=#0000bb>n</font></span><span class=php_007700><font color=#007700>]);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>catch</font></span><span class=php_007700><font color=#007700>(</font></span><span class=php_0000BB><font color=#0000bb>e</font></span><span class=php_007700><font color=#007700>)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_FF8000><font color=#ff8000>//&nbsp;mozilla某些版本没有readyState属性<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_007700><font color=#007700>if&nbsp;(</font></span><span class=php_0000BB><font color=#0000bb>objXMLHttp</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>readyState&nbsp;</font></span><span class=php_007700><font color=#007700>==&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>null</font></span><span class=php_007700><font color=#007700>)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>objXMLHttp</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>readyState&nbsp;</font></span><span class=php_007700><font color=#007700>=&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>0</font></span><span class=php_007700><font color=#007700>;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>objXMLHttp</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>addEventListener</font></span><span class=php_007700><font color=#007700>(</font></span><span class=php_DD0000><font color=#dd0000>"load"</font></span><span class=php_007700><font color=#007700>,&nbsp;function&nbsp;()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>objXMLHttp</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>readyState&nbsp;</font></span><span class=php_007700><font color=#007700>=&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>4</font></span><span class=php_007700><font color=#007700>;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</font></span><span class=php_0000BB><font color=#0000bb>typeof&nbsp;objXMLHttp</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>onreadystatechange&nbsp;</font></span><span class=php_007700><font color=#007700>==&nbsp;</font></span><span class=php_DD0000><font color=#dd0000>"function"</font></span><span class=php_007700><font color=#007700>)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>objXMLHttp</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>onreadystatechange</font></span><span class=php_007700><font color=#007700>();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>false</font></span><span class=php_007700><font color=#007700>);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>objXMLHttp</font></span><span class=php_007700><font color=#007700>;<br>&nbsp;&nbsp;&nbsp;&nbsp;},<br>&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_FF8000><font color=#ff8000>//&nbsp;发送请求(方法[post,get],&nbsp;地址,&nbsp;数据,&nbsp;回调函数)<br>&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>sendReq</font></span><span class=php_007700><font color=#007700>:&nbsp;function&nbsp;(</font></span><span class=php_0000BB><font color=#0000bb>method</font></span><span class=php_007700><font color=#007700>,&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>url</font></span><span class=php_007700><font color=#007700>,&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>data</font></span><span class=php_007700><font color=#007700>,&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>callback</font></span><span class=php_007700><font color=#007700>)<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>objXMLHttp&nbsp;</font></span><span class=php_007700><font color=#007700>=&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>this</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>_getInstance</font></span><span class=php_007700><font color=#007700>();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>with</font></span><span class=php_007700><font color=#007700>(</font></span><span class=php_0000BB><font color=#0000bb>objXMLHttp</font></span><span class=php_007700><font color=#007700>)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>try<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_007700><font color=#007700>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_FF8000><font color=#ff8000>//&nbsp;加随机数防止缓存<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_007700><font color=#007700>if&nbsp;(</font></span><span class=php_0000BB><font color=#0000bb>url</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>indexOf</font></span><span class=php_007700><font color=#007700>(</font></span><span class=php_DD0000><font color=#dd0000>"?"</font></span><span class=php_007700><font color=#007700>)&nbsp;&gt;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>0</font></span><span class=php_007700><font color=#007700>)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>url&nbsp;</font></span><span class=php_007700><font color=#007700>+=&nbsp;</font></span><span class=php_DD0000><font color=#dd0000>"&amp;randnum="&nbsp;</font></span><span class=php_007700><font color=#007700>+&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>Math</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>random</font></span><span class=php_007700><font color=#007700>();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>url&nbsp;</font></span><span class=php_007700><font color=#007700>+=&nbsp;</font></span><span class=php_DD0000><font color=#dd0000>"?randnum="&nbsp;</font></span><span class=php_007700><font color=#007700>+&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>Math</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>random</font></span><span class=php_007700><font color=#007700>();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>open</font></span><span class=php_007700><font color=#007700>(</font></span><span class=php_0000BB><font color=#0000bb>method</font></span><span class=php_007700><font color=#007700>,&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>url</font></span><span class=php_007700><font color=#007700>,&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>true</font></span><span class=php_007700><font color=#007700>);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_FF8000><font color=#ff8000>//&nbsp;设定请求编码方式<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>setRequestHeader</font></span><span class=php_007700><font color=#007700>(</font></span><span class=php_DD0000><font color=#dd0000>'Content-Type'</font></span><span class=php_007700><font color=#007700>,&nbsp;</font></span><span class=php_DD0000><font color=#dd0000>'application/x-www-form-urlencoded;&nbsp;charset=UTF-8'</font></span><span class=php_007700><font color=#007700>);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>send</font></span><span class=php_007700><font color=#007700>(</font></span><span class=php_0000BB><font color=#0000bb>data</font></span><span class=php_007700><font color=#007700>);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>onreadystatechange&nbsp;</font></span><span class=php_007700><font color=#007700>=&nbsp;function&nbsp;()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</font></span><span class=php_0000BB><font color=#0000bb>objXMLHttp</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>readyState&nbsp;</font></span><span class=php_007700><font color=#007700>==&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>4&nbsp;</font></span><span class=php_007700><font color=#007700>&amp;&amp;&nbsp;(</font></span><span class=php_0000BB><font color=#0000bb>objXMLHttp</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>status&nbsp;</font></span><span class=php_007700><font color=#007700>==&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>200&nbsp;</font></span><span class=php_007700><font color=#007700>||&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>objXMLHttp</font></span><span class=php_007700><font color=#007700>.</font></span><span class=php_0000BB><font color=#0000bb>status&nbsp;</font></span><span class=php_007700><font color=#007700>==&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>304</font></span><span class=php_007700><font color=#007700>))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>callback</font></span><span class=php_007700><font color=#007700>(</font></span><span class=php_0000BB><font color=#0000bb>objXMLHttp</font></span><span class=php_007700><font color=#007700>);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>catch</font></span><span class=php_007700><font color=#007700>(</font></span><span class=php_0000BB><font color=#0000bb>e</font></span><span class=php_007700><font color=#007700>)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>alert</font></span><span class=php_007700><font color=#007700>(</font></span><span class=php_0000BB><font color=#0000bb>e</font></span><span class=php_007700><font color=#007700>);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>};&nbsp; </font><br></span></p>
<p>示例： </p>
<div class=php_code><span class=php_000000><span class=php_0000BB></span><span class=php_007700><font color=#007700>&lt;</font></span><span class=php_0000BB><font color=#0000bb>script&nbsp;type</font></span><span class=php_007700><font color=#007700>=</font></span><span class=php_DD0000><font color=#dd0000>"text/javascript"&nbsp;</font></span><span class=php_0000BB><font color=#0000bb>src</font></span><span class=php_007700><font color=#007700>=</font></span><span class=php_DD0000><font color=#dd0000>"xmlhttp.js"</font></span><span class=php_007700><font color=#007700>&gt;</font></span><span class=php_0000BB><font color=#0000bb>&lt;/script&gt;<br></font></span>&lt;script&nbsp;type="text/javascript"&gt;<br>function&nbsp;test(obj)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;alert(obj.statusText);<br>}<br>XMLHttp.sendReq('GET',&nbsp;'http://www.ugia.cn/wp-data/test.htm',&nbsp;'',&nbsp;test);<br>XMLHttp.sendReq('GET',&nbsp;'http://www.ugia.cn/wp-data/test.htm',&nbsp;'',&nbsp;test);<br>XMLHttp.sendReq('GET',&nbsp;'http://www.ugia.cn/wp-data/test.htm',&nbsp;'',&nbsp;test);<br>XMLHttp.sendReq('GET',&nbsp;'http://www.ugia.cn/wp-data/test.htm',&nbsp;'',&nbsp;test);<br>alert('Pool&nbsp;length:'&nbsp;+&nbsp;XMLHttp._objPool.length);<br>&lt;/script&gt;&nbsp; <br><br><a href="http://blog.csdn.net/lee576/archive/2008/01/07/2029445.aspx">http://blog.csdn.net/lee576/archive/2008/01/07/2029445.aspx</a><br></span></div>
<img src ="http://www.phpweblog.net/fuyongjie/aggbug/3657.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.phpweblog.net/fuyongjie/" target="_blank">bestmost</a> 2008-05-21 16:06 <a href="http://www.phpweblog.net/fuyongjie/archive/2008/05/21/3657.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Ajax 同一页面同时执行多个 XMLHTTP</title><link>http://www.phpweblog.net/fuyongjie/archive/2008/05/21/3654.html</link><dc:creator>bestmost</dc:creator><author>bestmost</author><pubDate>Wed, 21 May 2008 08:03:00 GMT</pubDate><guid>http://www.phpweblog.net/fuyongjie/archive/2008/05/21/3654.html</guid><wfw:comment>http://www.phpweblog.net/fuyongjie/comments/3654.html</wfw:comment><comments>http://www.phpweblog.net/fuyongjie/archive/2008/05/21/3654.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.phpweblog.net/fuyongjie/comments/commentRss/3654.html</wfw:commentRss><trackback:ping>http://www.phpweblog.net/fuyongjie/services/trackbacks/3654.html</trackback:ping><description><![CDATA[<p style="FONT-SIZE: 14pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ajax 同一页面如何同时执行多个 XMLHTTP 呢，比如博客页，需要同时利用 Ajax 读取作者信息、文章信息、评论信息&#8230;&#8230;</p>
<p style="FONT-SIZE: 14pt">我们的第一反应可能是创建多个全局 XMLHTTP 对象，但这并不现实。其实实现方式非常简单，就是给 onreadystatechange 对应的回调函数加上参数，以下代码是解决方案中一个函数中的一段代码。</p>
<p style="FONT-SIZE: 14pt"></p>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">xmlhttp.open(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">GET</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">ajax_process.aspx?a=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;a,&nbsp;</span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">);<br><img id=Codehighlighter1_96_128_Open_Image onclick="this.style.display='none'; Codehighlighter1_96_128_Open_Text.style.display='none'; Codehighlighter1_96_128_Closed_Image.style.display='inline'; Codehighlighter1_96_128_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_96_128_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_96_128_Closed_Text.style.display='none'; Codehighlighter1_96_128_Open_Image.style.display='inline'; Codehighlighter1_96_128_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedBlock.gif" align=top>xmlhttp.onreadystatechange&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">function</span><span style="COLOR: #000000">&nbsp;()&nbsp;</span><span id=Codehighlighter1_96_128_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_96_128_Open_Text><span style="COLOR: #000000">{&nbsp;OnReadyStateChng(xmlhttp,&nbsp;a);&nbsp;}</span></span><span style="COLOR: #000000">;<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top>xmlhttp.send(</span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">);<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span></div>
<p style="FONT-SIZE: 14pt">只是改写 onreadystatechange&nbsp;的属性值，这样就可以为 OnReadyStateChng 函数赋参数了。如是我们写作 xmlhttp.onreadystatechange = OnReadyStateChng;，那么 OnReadyStateChng 就不能有参数了，也就无法获得是哪个 xmlhttp 的响应，也就无法获得是响应后要对哪个控件进行设置。</p>
<p style="FONT-SIZE: 14pt">我们可以看一个完整的示例，前台页面是普通的 Ajax 技术的 HTML 页面，后台使用的是 <a href="http://www.cftea.com/docs/" target=_blank>ASP.NET</a> 的 .aspx 文件，之所以采用 ASP.NET，是为了演示延时处理功能。</p>
<p style="FONT-SIZE: 14pt">前台程序</p>
<div style="FONT-SIZE: 14pt"><br>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE&nbsp;html&nbsp;PUBLIC&nbsp;"-//W3C//DTD&nbsp;XHTML&nbsp;1.0&nbsp;Transitional//EN"&nbsp;"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">html&nbsp;</span><span style="COLOR: #ff0000">xmlns</span><span style="COLOR: #0000ff">="http://www.w3.org/1999/xhtml"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">meta&nbsp;</span><span style="COLOR: #ff0000">http-equiv</span><span style="COLOR: #0000ff">="Content-Type"</span><span style="COLOR: #ff0000">&nbsp;content</span><span style="COLOR: #0000ff">="text/html;&nbsp;charset=utf8"</span><span style="COLOR: #ff0000">&nbsp;</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">Ajax&nbsp;Test</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top><br><img id=Codehighlighter1_321_1999_Open_Image onclick="this.style.display='none'; Codehighlighter1_321_1999_Open_Text.style.display='none'; Codehighlighter1_321_1999_Closed_Image.style.display='inline'; Codehighlighter1_321_1999_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_321_1999_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_321_1999_Closed_Text.style.display='none'; Codehighlighter1_321_1999_Open_Image.style.display='inline'; Codehighlighter1_321_1999_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">script&nbsp;</span><span style="COLOR: #ff0000">type</span><span style="COLOR: #0000ff">="text/javascript"</span><span style="COLOR: #ff0000">&nbsp;language</span><span style="COLOR: #0000ff">="javascript"</span><span style="COLOR: #0000ff">&gt;</span><span id=Codehighlighter1_321_1999_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_321_1999_Open_Text><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&lt;!--</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">//</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">&nbsp;1.创建XMLHttpRequest对象</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">function</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;CreateHTTPObject()<br><img id=Codehighlighter1_381_1108_Open_Image onclick="this.style.display='none'; Codehighlighter1_381_1108_Open_Text.style.display='none'; Codehighlighter1_381_1108_Closed_Image.style.display='inline'; Codehighlighter1_381_1108_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_381_1108_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_381_1108_Closed_Text.style.display='none'; Codehighlighter1_381_1108_Open_Image.style.display='inline'; Codehighlighter1_381_1108_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top></span><span id=Codehighlighter1_381_1108_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_381_1108_Open_Text><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">var</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;xmlhttp;<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">try</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img id=Codehighlighter1_417_478_Open_Image onclick="this.style.display='none'; Codehighlighter1_417_478_Open_Text.style.display='none'; Codehighlighter1_417_478_Closed_Image.style.display='inline'; Codehighlighter1_417_478_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_417_478_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_417_478_Closed_Text.style.display='none'; Codehighlighter1_417_478_Open_Image.style.display='inline'; Codehighlighter1_417_478_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_417_478_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_417_478_Open_Text><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlhttp&nbsp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">new</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;ActiveXObject(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">Msxml2.XMLHTTP</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">);<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">catch</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;(e)<br><img id=Codehighlighter1_498_665_Open_Image onclick="this.style.display='none'; Codehighlighter1_498_665_Open_Text.style.display='none'; Codehighlighter1_498_665_Closed_Image.style.display='inline'; Codehighlighter1_498_665_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_498_665_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_498_665_Closed_Text.style.display='none'; Codehighlighter1_498_665_Open_Image.style.display='inline'; Codehighlighter1_498_665_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_498_665_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_498_665_Open_Text><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">try</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img id=Codehighlighter1_520_592_Open_Image onclick="this.style.display='none'; Codehighlighter1_520_592_Open_Text.style.display='none'; Codehighlighter1_520_592_Closed_Image.style.display='inline'; Codehighlighter1_520_592_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_520_592_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_520_592_Closed_Text.style.display='none'; Codehighlighter1_520_592_Open_Image.style.display='inline'; Codehighlighter1_520_592_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_520_592_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_520_592_Open_Text><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlhttp&nbsp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">new</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;ActiveXObject(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">Microsoft.XMLHTTP</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">);<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">catch</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;(e)<br><img id=Codehighlighter1_620_659_Open_Image onclick="this.style.display='none'; Codehighlighter1_620_659_Open_Text.style.display='none'; Codehighlighter1_620_659_Closed_Image.style.display='inline'; Codehighlighter1_620_659_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_620_659_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_620_659_Closed_Text.style.display='none'; Codehighlighter1_620_659_Open_Image.style.display='inline'; Codehighlighter1_620_659_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_620_659_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_620_659_Open_Text><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlhttp&nbsp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">false</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">;<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">if</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">!</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">xmlhttp&nbsp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&amp;&amp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">typeof</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;XMLHttpRequest</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">!=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">'undefined')<br><img id=Codehighlighter1_732_879_Open_Image onclick="this.style.display='none'; Codehighlighter1_732_879_Open_Text.style.display='none'; Codehighlighter1_732_879_Closed_Image.style.display='inline'; Codehighlighter1_732_879_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_732_879_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_732_879_Closed_Text.style.display='none'; Codehighlighter1_732_879_Open_Image.style.display='inline'; Codehighlighter1_732_879_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_732_879_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_732_879_Open_Text><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">try</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img id=Codehighlighter1_754_808_Open_Image onclick="this.style.display='none'; Codehighlighter1_754_808_Open_Text.style.display='none'; Codehighlighter1_754_808_Closed_Image.style.display='inline'; Codehighlighter1_754_808_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_754_808_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_754_808_Closed_Text.style.display='none'; Codehighlighter1_754_808_Open_Image.style.display='inline'; Codehighlighter1_754_808_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_754_808_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_754_808_Open_Text><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlhttp&nbsp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">new</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;XMLHttpRequest();<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">catch</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;(e)<br><img id=Codehighlighter1_836_873_Open_Image onclick="this.style.display='none'; Codehighlighter1_836_873_Open_Text.style.display='none'; Codehighlighter1_836_873_Closed_Image.style.display='inline'; Codehighlighter1_836_873_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_836_873_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_836_873_Closed_Text.style.display='none'; Codehighlighter1_836_873_Open_Image.style.display='inline'; Codehighlighter1_836_873_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_836_873_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_836_873_Open_Text><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlhttp</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">false</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">;<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">if</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">!</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">xmlhttp&nbsp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&amp;&amp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;window.createRequest)<br><img id=Codehighlighter1_932_1081_Open_Image onclick="this.style.display='none'; Codehighlighter1_932_1081_Open_Text.style.display='none'; Codehighlighter1_932_1081_Closed_Image.style.display='inline'; Codehighlighter1_932_1081_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_932_1081_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_932_1081_Closed_Text.style.display='none'; Codehighlighter1_932_1081_Open_Image.style.display='inline'; Codehighlighter1_932_1081_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_932_1081_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_932_1081_Open_Text><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">try</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img id=Codehighlighter1_954_1010_Open_Image onclick="this.style.display='none'; Codehighlighter1_954_1010_Open_Text.style.display='none'; Codehighlighter1_954_1010_Closed_Image.style.display='inline'; Codehighlighter1_954_1010_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_954_1010_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_954_1010_Closed_Text.style.display='none'; Codehighlighter1_954_1010_Open_Image.style.display='inline'; Codehighlighter1_954_1010_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_954_1010_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_954_1010_Open_Text><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlhttp&nbsp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;window.createRequest();<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">catch</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;(e)<br><img id=Codehighlighter1_1038_1075_Open_Image onclick="this.style.display='none'; Codehighlighter1_1038_1075_Open_Text.style.display='none'; Codehighlighter1_1038_1075_Closed_Image.style.display='inline'; Codehighlighter1_1038_1075_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_1038_1075_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1038_1075_Closed_Text.style.display='none'; Codehighlighter1_1038_1075_Open_Image.style.display='inline'; Codehighlighter1_1038_1075_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_1038_1075_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_1038_1075_Open_Text><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlhttp</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">false</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">;<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">return</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;xmlhttp;<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">//</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">&nbsp;2.浏览器&nbsp;-&gt;&nbsp;服务器&nbsp;&nbsp;(提交请求信息)</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">function</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;SubmitMsg(a)<br><img id=Codehighlighter1_1163_1489_Open_Image onclick="this.style.display='none'; Codehighlighter1_1163_1489_Open_Text.style.display='none'; Codehighlighter1_1163_1489_Closed_Image.style.display='inline'; Codehighlighter1_1163_1489_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_1163_1489_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1163_1489_Closed_Text.style.display='none'; Codehighlighter1_1163_1489_Open_Image.style.display='inline'; Codehighlighter1_1163_1489_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top></span><span id=Codehighlighter1_1163_1489_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_1163_1489_Open_Text><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">var</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;xmlhttp&nbsp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;CreateHTTPObject();<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">//</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">alert(xmlhttp);</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">if</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">!</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">xmlhttp)<br><img id=Codehighlighter1_1244_1284_Open_Image onclick="this.style.display='none'; Codehighlighter1_1244_1284_Open_Text.style.display='none'; Codehighlighter1_1244_1284_Closed_Image.style.display='inline'; Codehighlighter1_1244_1284_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_1244_1284_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1244_1284_Closed_Text.style.display='none'; Codehighlighter1_1244_1284_Open_Image.style.display='inline'; Codehighlighter1_1244_1284_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_1244_1284_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_1244_1284_Open_Text><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">return</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">;&nbsp;</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">//</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">无法创建&nbsp;xmlhttp&nbsp;对象</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">//</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">Ajax&nbsp;提交</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlhttp.open(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">GET</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">,&nbsp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><span style="COLOR: #000000">ajax_process.aspx?a=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">+</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;a,&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">true</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">);<br><img id=Codehighlighter1_1430_1462_Open_Image onclick="this.style.display='none'; Codehighlighter1_1430_1462_Open_Text.style.display='none'; Codehighlighter1_1430_1462_Closed_Image.style.display='inline'; Codehighlighter1_1430_1462_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_1430_1462_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1430_1462_Closed_Text.style.display='none'; Codehighlighter1_1430_1462_Open_Image.style.display='inline'; Codehighlighter1_1430_1462_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;xmlhttp.onreadystatechange&nbsp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">function</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;()&nbsp;</span><span id=Codehighlighter1_1430_1462_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_1430_1462_Open_Text><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{&nbsp;OnReadyStateChng(xmlhttp,&nbsp;a);&nbsp;}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">;<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;xmlhttp.send(</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">null</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">);<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">//</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">&nbsp;3.服务器&nbsp;-&gt;&nbsp;浏览器&nbsp;&nbsp;(正确时返回数据)</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">function</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;OnReadyStateChng(xmlhttp,&nbsp;a)<br><img id=Codehighlighter1_1563_1917_Open_Image onclick="this.style.display='none'; Codehighlighter1_1563_1917_Open_Text.style.display='none'; Codehighlighter1_1563_1917_Closed_Image.style.display='inline'; Codehighlighter1_1563_1917_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_1563_1917_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1563_1917_Closed_Text.style.display='none'; Codehighlighter1_1563_1917_Open_Image.style.display='inline'; Codehighlighter1_1563_1917_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top></span><span id=Codehighlighter1_1563_1917_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_1563_1917_Open_Text><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">if</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;(xmlhttp.readyState&nbsp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">==</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">4</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">)<br><img id=Codehighlighter1_1602_1821_Open_Image onclick="this.style.display='none'; Codehighlighter1_1602_1821_Open_Text.style.display='none'; Codehighlighter1_1602_1821_Closed_Image.style.display='inline'; Codehighlighter1_1602_1821_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_1602_1821_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1602_1821_Closed_Text.style.display='none'; Codehighlighter1_1602_1821_Open_Image.style.display='inline'; Codehighlighter1_1602_1821_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_1602_1821_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_1602_1821_Open_Text><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">if</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;(xmlhttp.status&nbsp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">==</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">200</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">)<br><img id=Codehighlighter1_1647_1730_Open_Image onclick="this.style.display='none'; Codehighlighter1_1647_1730_Open_Text.style.display='none'; Codehighlighter1_1647_1730_Closed_Image.style.display='inline'; Codehighlighter1_1647_1730_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_1647_1730_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1647_1730_Closed_Text.style.display='none'; Codehighlighter1_1647_1730_Open_Image.style.display='inline'; Codehighlighter1_1647_1730_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_1647_1730_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_1647_1730_Open_Text><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.getElementById(a).innerHTML&nbsp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;xmlhttp.responseText;<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">else</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img id=Codehighlighter1_1753_1815_Open_Image onclick="this.style.display='none'; Codehighlighter1_1753_1815_Open_Text.style.display='none'; Codehighlighter1_1753_1815_Closed_Image.style.display='inline'; Codehighlighter1_1753_1815_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_1753_1815_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1753_1815_Closed_Text.style.display='none'; Codehighlighter1_1753_1815_Open_Image.style.display='inline'; Codehighlighter1_1753_1815_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_1753_1815_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_1753_1815_Open_Text><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">HTTP&nbsp;错误，状态码：</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">+</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;xmlhttp.status);<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;<br><img id=Codehighlighter1_1830_1915_Open_Image onclick="this.style.display='none'; Codehighlighter1_1830_1915_Open_Text.style.display='none'; Codehighlighter1_1830_1915_Closed_Image.style.display='inline'; Codehighlighter1_1830_1915_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_1830_1915_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1830_1915_Closed_Text.style.display='none'; Codehighlighter1_1830_1915_Open_Image.style.display='inline'; Codehighlighter1_1830_1915_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">else</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;</span><span id=Codehighlighter1_1830_1915_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_1830_1915_Open_Text><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{//显示一个等待响应的图片<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.getElementById(a).innerHTML&nbsp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&lt;img&nbsp;src=tpl/1-0.gif&nbsp;align=absmiddle&gt;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">;<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top><br><img id=Codehighlighter1_1939_1993_Open_Image onclick="this.style.display='none'; Codehighlighter1_1939_1993_Open_Text.style.display='none'; Codehighlighter1_1939_1993_Closed_Image.style.display='inline'; Codehighlighter1_1939_1993_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_1939_1993_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1939_1993_Closed_Text.style.display='none'; Codehighlighter1_1939_1993_Open_Image.style.display='inline'; Codehighlighter1_1939_1993_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top></span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">function</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;loadall()</span><span id=Codehighlighter1_1939_1993_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_1939_1993_Open_Text><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>SubmitMsg(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">a1</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">);<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>SubmitMsg(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">a2</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">);<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>SubmitMsg(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">a3</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">);<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">--&gt;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">script</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">body&nbsp;</span><span style="COLOR: #ff0000">onload</span><span style="COLOR: #0000ff">=loadall()</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">div&nbsp;</span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="a1"</span><span style="COLOR: #ff0000">&nbsp;style</span><span style="COLOR: #0000ff">="border:1px&nbsp;solid&nbsp;red;float:left"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">1</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">div</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">div&nbsp;</span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="a2"</span><span style="COLOR: #ff0000">&nbsp;style</span><span style="COLOR: #0000ff">="border:1px&nbsp;solid&nbsp;green;float:left"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">2</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">div</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">div&nbsp;</span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="a3"</span><span style="COLOR: #ff0000">&nbsp;style</span><span style="COLOR: #0000ff">="border:1px&nbsp;solid&nbsp;yellow"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">3</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">div</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span></div>
</div>
<p style="FONT-SIZE: 14pt">后台程序</p>
<p style="FONT-SIZE: 14pt"></p>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">&lt;%</span><span style="COLOR: #000000">@&nbsp;Page&nbsp;Language</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">C#</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">%&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #000000">&lt;%</span><span style="COLOR: #000000">Response.Expires&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;&nbsp;</span><span style="COLOR: #000000">%&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #000000">&lt;!</span><span style="COLOR: #000000">DOCTYPE&nbsp;html&nbsp;PUBLIC&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">-//W3C//DTD&nbsp;XHTML&nbsp;1.0&nbsp;Transitional//EN</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">script&nbsp;runat</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">server</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;Page_Load(</span><span style="COLOR: #0000ff">object</span><span style="COLOR: #000000">&nbsp;sender,&nbsp;EventArgs&nbsp;e)<br><img id=Codehighlighter1_250_638_Open_Image onclick="this.style.display='none'; Codehighlighter1_250_638_Open_Text.style.display='none'; Codehighlighter1_250_638_Closed_Image.style.display='inline'; Codehighlighter1_250_638_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_250_638_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_250_638_Closed_Text.style.display='none'; Codehighlighter1_250_638_Open_Image.style.display='inline'; Codehighlighter1_250_638_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_250_638_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_250_638_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(Request.QueryString[</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">a</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">]&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">a1</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_306_374_Open_Image onclick="this.style.display='none'; Codehighlighter1_306_374_Open_Text.style.display='none'; Codehighlighter1_306_374_Closed_Image.style.display='inline'; Codehighlighter1_306_374_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_306_374_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_306_374_Closed_Text.style.display='none'; Codehighlighter1_306_374_Open_Image.style.display='inline'; Codehighlighter1_306_374_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_306_374_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_306_374_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.Threading.Thread.Sleep(</span><span style="COLOR: #000000">3000</span><span style="COLOR: #000000">);&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">延时&nbsp;3&nbsp;秒</span><span style="COLOR: #008000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(Request.QueryString[</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">a</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">]&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">a2</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_435_503_Open_Image onclick="this.style.display='none'; Codehighlighter1_435_503_Open_Text.style.display='none'; Codehighlighter1_435_503_Closed_Image.style.display='inline'; Codehighlighter1_435_503_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_435_503_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_435_503_Closed_Text.style.display='none'; Codehighlighter1_435_503_Open_Image.style.display='inline'; Codehighlighter1_435_503_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_435_503_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_435_503_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.Threading.Thread.Sleep(</span><span style="COLOR: #000000">1000</span><span style="COLOR: #000000">);&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">延时&nbsp;1&nbsp;秒</span><span style="COLOR: #008000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(Request.QueryString[</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">a</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">]&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">a3</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_564_632_Open_Image onclick="this.style.display='none'; Codehighlighter1_564_632_Open_Text.style.display='none'; Codehighlighter1_564_632_Closed_Image.style.display='inline'; Codehighlighter1_564_632_Closed_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_564_632_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_564_632_Closed_Text.style.display='none'; Codehighlighter1_564_632_Open_Image.style.display='inline'; Codehighlighter1_564_632_Open_Text.style.display='inline';" src="http://www.phpweblog.net/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_564_632_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.phpweblog.net/Images/dot.gif"></span><span id=Codehighlighter1_564_632_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.Threading.Thread.Sleep(</span><span style="COLOR: #000000">2000</span><span style="COLOR: #000000">);&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">延时&nbsp;2&nbsp;秒</span><span style="COLOR: #008000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">script</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">html&nbsp;xmlns</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">http://www.w3.org/1999/xhtml</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">head&nbsp;runat</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">server</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">title</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">Ajax&nbsp;Test</span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">title</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">head</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">body</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">form&nbsp;id</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">form1</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;runat</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">server</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">div</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">div</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">form</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">body</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">html</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.phpweblog.net/Images/OutliningIndicators/None.gif" align=top></span></div>
<p style="FONT-SIZE: 14pt">演示解说</p>
<p style="FONT-SIZE: 14pt">前台页面发出三个异步回送请求，分别为 a1、a2、a3 请求值，在后台页面中，通过延时模拟处理 a1 需要 3 秒，处理 a2 需要 1 秒，处理 a3 需要 2 秒。通过演示发现最先有变化的是 a2，然后是 a3、a1，顺序并没有乱，也没有出现显示混乱的情况。注意后台页面需要 Response.Expires = 0; 这么一句代码指示页面立即过期，否则刷新时请求的是缓存的页面，演示也就没有效果了。</p>
<p style="FONT-SIZE: 14pt">另外</p>
<p style="FONT-SIZE: 14pt">每个 xmlhttp 的 onreadystatechange <span style="COLOR: red">对应的函数名称也可以不同，不仅限于参数不同</span>。<br></p>
<img src ="http://www.phpweblog.net/fuyongjie/aggbug/3654.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.phpweblog.net/fuyongjie/" target="_blank">bestmost</a> 2008-05-21 16:03 <a href="http://www.phpweblog.net/fuyongjie/archive/2008/05/21/3654.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>