﻿<?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>BlogJava-zhyiwww -随笔分类-javascript</title><link>http://www.blogjava.net/zhyiwww/category/21210.html</link><description>用平实的笔，记录编程路上的点点滴滴………</description><language>zh-cn</language><lastBuildDate>Thu, 31 Oct 2013 10:38:24 GMT</lastBuildDate><pubDate>Thu, 31 Oct 2013 10:38:24 GMT</pubDate><ttl>60</ttl><item><title>kindeditor使用的关键点</title><link>http://www.blogjava.net/zhyiwww/archive/2013/10/31/405856.html</link><dc:creator>zhyiwww</dc:creator><author>zhyiwww</author><pubDate>Thu, 31 Oct 2013 09:32:00 GMT</pubDate><guid>http://www.blogjava.net/zhyiwww/archive/2013/10/31/405856.html</guid><wfw:comment>http://www.blogjava.net/zhyiwww/comments/405856.html</wfw:comment><comments>http://www.blogjava.net/zhyiwww/archive/2013/10/31/405856.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/zhyiwww/comments/commentRss/405856.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zhyiwww/services/trackbacks/405856.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 在页面使用kindeditor编辑器时，有以下步骤:&nbsp;&nbsp;&nbsp; [1]下载kindeditor压缩包&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 下载地址 ：http://kindeditor.googlecode.com/files/kindeditor-4.1.9.zip&nbsp;&nbsp;&nb...&nbsp;&nbsp;<a href='http://www.blogjava.net/zhyiwww/archive/2013/10/31/405856.html'>阅读全文</a><img src ="http://www.blogjava.net/zhyiwww/aggbug/405856.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zhyiwww/" target="_blank">zhyiwww</a> 2013-10-31 17:32 <a href="http://www.blogjava.net/zhyiwww/archive/2013/10/31/405856.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JQuery常用方法</title><link>http://www.blogjava.net/zhyiwww/archive/2013/10/31/405843.html</link><dc:creator>zhyiwww</dc:creator><author>zhyiwww</author><pubDate>Thu, 31 Oct 2013 05:17:00 GMT</pubDate><guid>http://www.blogjava.net/zhyiwww/archive/2013/10/31/405843.html</guid><wfw:comment>http://www.blogjava.net/zhyiwww/comments/405843.html</wfw:comment><comments>http://www.blogjava.net/zhyiwww/archive/2013/10/31/405843.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/zhyiwww/comments/commentRss/405843.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zhyiwww/services/trackbacks/405843.html</trackback:ping><description><![CDATA[<br />【radio操作方法】<br />取值：<br /><div>$("#sex").val();</div>设置值为选取状态：<br /><div>$("input:radio[value='']").attr("checked", true);<br /><br />【select操作方法】<br />取值：<br /><div>$("#stat_type").val();</div>设置选中：<br /><div>$("#stat_type").val('&lt;%=statType%&gt;');</div><br /></div><img src ="http://www.blogjava.net/zhyiwww/aggbug/405843.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zhyiwww/" target="_blank">zhyiwww</a> 2013-10-31 13:17 <a href="http://www.blogjava.net/zhyiwww/archive/2013/10/31/405843.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>javascript dom清空table的方法</title><link>http://www.blogjava.net/zhyiwww/archive/2010/02/03/311813.html</link><dc:creator>zhyiwww</dc:creator><author>zhyiwww</author><pubDate>Wed, 03 Feb 2010 07:52:00 GMT</pubDate><guid>http://www.blogjava.net/zhyiwww/archive/2010/02/03/311813.html</guid><wfw:comment>http://www.blogjava.net/zhyiwww/comments/311813.html</wfw:comment><comments>http://www.blogjava.net/zhyiwww/archive/2010/02/03/311813.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/zhyiwww/comments/commentRss/311813.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zhyiwww/services/trackbacks/311813.html</trackback:ping><description><![CDATA[<br />
[1]通常方法<br />
循环table的rows，然后一个一个删除。<br />
这个方法是通常的方法，可行，但是效率不好。<br />
<br />
[2]另一个方法<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var artTable = document.getElementById("artical_table");&nbsp; <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; console.debug(artTable.getElementsByTagName("thead")[0]);<br />
<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var artBody=artTable.tBodies[0];<br />
<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //clear table<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; artBody.innerHTML='';<br />
<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br />
<br />
<img src ="http://www.blogjava.net/zhyiwww/aggbug/311813.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zhyiwww/" target="_blank">zhyiwww</a> 2010-02-03 15:52 <a href="http://www.blogjava.net/zhyiwww/archive/2010/02/03/311813.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>prototype浏览器类型的判断</title><link>http://www.blogjava.net/zhyiwww/archive/2009/06/24/283874.html</link><dc:creator>zhyiwww</dc:creator><author>zhyiwww</author><pubDate>Wed, 24 Jun 2009 01:55:00 GMT</pubDate><guid>http://www.blogjava.net/zhyiwww/archive/2009/06/24/283874.html</guid><wfw:comment>http://www.blogjava.net/zhyiwww/comments/283874.html</wfw:comment><comments>http://www.blogjava.net/zhyiwww/archive/2009/06/24/283874.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/zhyiwww/comments/commentRss/283874.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zhyiwww/services/trackbacks/283874.html</trackback:ping><description><![CDATA[if(Prototype.Browser.IE){<br />     console.debug("your browser is IE");<br />}else{<br />   console.debug("your browser is not IE");<br />}<br /><br />可以用Firebug查看<br /><div class="logRow logRow-command"><span class="objectBox objectBox-text">&gt;&gt;&gt;  Prototype.Browser</span></div><div class="logRow"><a class="objectLink objectLink-object"><span class="objectTitle">Object</span> IE=<span class="objectPropValue">false</span> Opera=<span class="objectPropValue">false</span> WebKit=<span class="objectPropValue">false</span> Gecko=<span class="objectPropValue">true</span></a></div><br /><span class="objectBox objectBox-text">&gt;&gt;  Prototype.Browser.WebKit</span><div class="logRow"><span class="objectBox objectBox-number">false</span></div><div class="logRow logRow-command"><span class="objectBox objectBox-text">&gt;&gt;&gt;  Prototype.Browser.Opera</span></div><div class="logRow"><span class="objectBox objectBox-number">false</span></div><div class="logRow logRow-command"><span class="objectBox objectBox-text">&gt;&gt;&gt;  Prototype.Browser.Gecko<br />true<br /><br />所以，用prototype判断浏览器可以用<br /><br />Prototype.Browser.*****来判断<br /></span></div><br /><img src ="http://www.blogjava.net/zhyiwww/aggbug/283874.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zhyiwww/" target="_blank">zhyiwww</a> 2009-06-24 09:55 <a href="http://www.blogjava.net/zhyiwww/archive/2009/06/24/283874.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>清空div得好方法</title><link>http://www.blogjava.net/zhyiwww/archive/2008/09/06/227421.html</link><dc:creator>zhyiwww</dc:creator><author>zhyiwww</author><pubDate>Sat, 06 Sep 2008 11:30:00 GMT</pubDate><guid>http://www.blogjava.net/zhyiwww/archive/2008/09/06/227421.html</guid><wfw:comment>http://www.blogjava.net/zhyiwww/comments/227421.html</wfw:comment><comments>http://www.blogjava.net/zhyiwww/archive/2008/09/06/227421.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/zhyiwww/comments/commentRss/227421.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zhyiwww/services/trackbacks/227421.html</trackback:ping><description><![CDATA[本来需要清空一个div里面的子div,我本来的办法是取得其子元素，然后再遍历，然后再删除。<br />今天问了一下冬瓜，他告诉了一个好方法，嘿嘿，不错，拿来和大家共享。<br /><br />function clear(divObj){<br /><br />    divObj.innerHTML="";<br />    <br />}<br /><br />如上面的方法，直接把div的innerHTML置成""就可以了。有简单，有高效。<br /><br /><img src ="http://www.blogjava.net/zhyiwww/aggbug/227421.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zhyiwww/" target="_blank">zhyiwww</a> 2008-09-06 19:30 <a href="http://www.blogjava.net/zhyiwww/archive/2008/09/06/227421.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在IE浏览器下用javascript解析XML的三种方法</title><link>http://www.blogjava.net/zhyiwww/archive/2008/06/02/205378.html</link><dc:creator>zhyiwww</dc:creator><author>zhyiwww</author><pubDate>Mon, 02 Jun 2008 09:49:00 GMT</pubDate><guid>http://www.blogjava.net/zhyiwww/archive/2008/06/02/205378.html</guid><wfw:comment>http://www.blogjava.net/zhyiwww/comments/205378.html</wfw:comment><comments>http://www.blogjava.net/zhyiwww/archive/2008/06/02/205378.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/zhyiwww/comments/commentRss/205378.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zhyiwww/services/trackbacks/205378.html</trackback:ping><description><![CDATA[我自己在学习的过程中才知道，在用javascript实现对xml的解析的时候，在不同的浏览器下面，有不同的方法。下面是在IE下面的解析方法，我说的三种，仅仅是我对于其做的一总结，希望能对正在学习ajax的您有所帮助。<br /><br />从服务器取得的XML结果：<br />  &lt;?xml version="1.0" encoding="UTF-8" ?&gt;<br /> &lt;citys&gt;<br /> &lt;city&gt;shanghai&lt;/city&gt;<br /> &lt;city&gt;tianjin&lt;/city&gt;<br /> &lt;city&gt;chengdu&lt;/city&gt;<br /> &lt;city&gt;chongqing&lt;/city&gt;<br /> &lt;city&gt;hainan&lt;/city&gt;<br />&lt;/citys&gt;<br /><br />解析方法（一）<br />        var doc = response.responseXML;<br />        //alert(doc);<br />   <br />        var root = doc.documentElement;<br />        alert(root.text);<br />        <br />        var cities = root.childNodes;<br />        alert(cities.length);<br />        <br />        for(var i=0;i&lt;cities.length;i++){<br />          var city = cities[i];<br />          alert(city.text);<br />        }<br /><br />解析方法（二）：<br />        var cities = doc.selectNodes("/citys/city");<br />        alert(cities.length);<br />        <br />        for(var i=0;i&lt;cities.length;i++){<br />          var city = cities[i];<br />          alert(city.text);<br />        }<br />        <br />解析方法（三）：<br /><br />  var doc = response.responseXML;<br />        var cs = doc.getElementsByTagName("city");      <br />        alert(cs.length);<br />        <br />        for(var i=0;i&lt;cs.length;i++){<br />          vara = cs[i];<br />          //alert(a);<br />          //alert(a.nodeName);<br />          //alert(a.nodeValue);<br />          var b = a.childNodes;<br />          //alert(b);<br />          var c=b[0];<br />          alert(c.nodeValue);<br />        }<br /><br />只有第三种方法，可以在IE和Firefox下面通用。<br />如果有不妥之处，请路过的您多多指教。<br /><br /><a href="/Files/zhyiwww/AjaxDemo.rar">本例子源码下载</a><br /><br /><br /><br /><img src ="http://www.blogjava.net/zhyiwww/aggbug/205378.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zhyiwww/" target="_blank">zhyiwww</a> 2008-06-02 17:49 <a href="http://www.blogjava.net/zhyiwww/archive/2008/06/02/205378.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在firefox浏览器下用javascript解析XML</title><link>http://www.blogjava.net/zhyiwww/archive/2008/06/02/205376.html</link><dc:creator>zhyiwww</dc:creator><author>zhyiwww</author><pubDate>Mon, 02 Jun 2008 09:40:00 GMT</pubDate><guid>http://www.blogjava.net/zhyiwww/archive/2008/06/02/205376.html</guid><wfw:comment>http://www.blogjava.net/zhyiwww/comments/205376.html</wfw:comment><comments>http://www.blogjava.net/zhyiwww/archive/2008/06/02/205376.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/zhyiwww/comments/commentRss/205376.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zhyiwww/services/trackbacks/205376.html</trackback:ping><description><![CDATA[刚接触ajax不久，想通过ajax实现从服务器上动态取得xml数据，然后，在客户端动态更新并显示。<br />但是，再firefox中，在取得xmlDom后，用在IE下面解析的办法（网上有很多的资料，也可以我的总结），怎么也不能取得标签文本的值。<br /><br />经过多次实践，才发现了下面的方法是可以实现的。原来很简单（见笑了…………）<br /><br />服务器返回XML结果如下：<br />  &lt;?xml version="1.0" encoding="UTF-8" ?&gt;<br />- &lt;citys&gt;<br /> &lt;city&gt;shanghai&lt;/city&gt;<br /> &lt;city&gt;tianjin&lt;/city&gt;<br /> &lt;city&gt;chengdu&lt;/city&gt;<br /> &lt;city&gt;chongqing&lt;/city&gt;<br /> &lt;city&gt;hainan&lt;/city&gt;<br />  &lt;/citys&gt;<br /><br />==========================================================================<br />解析如下：<br /><br />// 取得的是xmlDom对象<br />var doc = response.responseXML;<br />         // 根据标签来取得List对象<br />        var cs = doc.getElementsByTagName("city");      <br />        alert(cs.length);<br />        <br />        for(var i=0;i&lt;cs.length;i++){<br />          var a = cs[i];<br />          //alert(a);<br />          //alert(a.nodeName);<br />          //alert(a.nodeValue);<br />          var b = a.childNodes;<br />          <font color="#0000ff"><b>(我的疑问：为什么需要取得b，cs[i]不就是一个city的对象了，为什么还需要取得数组，然后再取其元素,疑惑中)</b></font><br />          //alert(b);<br />          var c=b[0];<br />          alert(c.nodeValue);<br />        }<br /><br />cs取得的结果应该是：<br /> &lt;city&gt;shanghai&lt;/city&gt;<br /> &lt;city&gt;tianjin&lt;/city&gt;<br /> &lt;city&gt;chengdu&lt;/city&gt;<br /> &lt;city&gt;chongqing&lt;/city&gt;<br /> &lt;city&gt;hainan&lt;/city&gt;<br />city Element对象的一个集合。<br />所以，对于a来说，那么就应该是<br /> &lt;city&gt;shanghai&lt;/city&gt;<br />每一个city Element元素的对象了，但是，错了。此处得到的是一个<br />Element标签元素的一个数组。<br />也就是说<font color="#ff1493"><b>用childNodes方法取得的对象永远是数组对象</b></font>。那么，你想遍历其中元素的话，就需要用c对象来取。<br /><br /><a href="/Files/zhyiwww/AjaxDemo.rar">本例子源代码下载</a><br /><br /><img src ="http://www.blogjava.net/zhyiwww/aggbug/205376.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zhyiwww/" target="_blank">zhyiwww</a> 2008-06-02 17:40 <a href="http://www.blogjava.net/zhyiwww/archive/2008/06/02/205376.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>AJAX(Javascript)解析xml简略总结</title><link>http://www.blogjava.net/zhyiwww/archive/2007/05/29/120741.html</link><dc:creator>zhyiwww</dc:creator><author>zhyiwww</author><pubDate>Tue, 29 May 2007 09:55:00 GMT</pubDate><guid>http://www.blogjava.net/zhyiwww/archive/2007/05/29/120741.html</guid><wfw:comment>http://www.blogjava.net/zhyiwww/comments/120741.html</wfw:comment><comments>http://www.blogjava.net/zhyiwww/archive/2007/05/29/120741.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/zhyiwww/comments/commentRss/120741.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zhyiwww/services/trackbacks/120741.html</trackback:ping><description><![CDATA[
		<p class="MsoNormal">
				<span style="font-family: 宋体;">首先，通过</span>
				<span lang="EN-US">ajax</span>
				<span style="font-family: 宋体;">向</span>
				<span lang="EN-US">url</span>
				<span style="font-family: 宋体;">提交请求，来取得远程</span>
				<span lang="EN-US">xml</span>
				<span style="font-family: 宋体;">数据。</span>
		</p>
		<p class="MsoNormal">
				<b>
						<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 0, 200);" lang="EN-US">var</span>
				</b>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US"> xmlDoc = response.responseXML;<span style=""></span><o:p></o:p></span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">此时，你得到了</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">xml</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">的文档对象。</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">那么你如何解析文档呢？</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">也就是，如何取得一个结点对象呢？</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<b>
						<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 0, 200);" lang="EN-US">var</span>
				</b>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US"> allPoi = xmlDoc.selectNodes(</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;" lang="EN-US">"/schemes/scheme/line/stops/stop/points/point"</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">);<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">通过</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">selectNodes</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">方法，我们可以得到所有的符合这个路径的所有子节点。</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">如果allPoi得到的是叶子节点的话，那么我们就可以通过<font color="#ff1493"><b><font size="4">allPoi[0].text</font></b><font size="2"><font color="#000000">来取得节点的值.</font></font></font><br /></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">下面，我们就可以遍历其对象了：</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">    </span>
				</span>
				<b>
						<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 0, 200);" lang="EN-US">for</span>
				</b>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">(</span>
				<b>
						<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 0, 200);" lang="EN-US">var</span>
				</b>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US"> i=0;i&lt;pois.</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 100, 200);" lang="EN-US">length</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">;i++){</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">       </span>
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 100, 200);" lang="EN-US">alert</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">(pois[i].selectSingleNode(</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;" lang="EN-US">"iLongitude"</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">).text);<span style="">       </span></span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">    </span>}<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">selectSingleNode</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">可以取得其中一个子节点，通过</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">text</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">属性来取得其对应的字符串值。</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">取得文档后，我们解析</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">xml</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">的时候也可以通过其他的方法，比如：</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">var stopsGroup = xmlDoc.getElementsByTagName("stops")<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">这种办法也一样可以取到你想要取得所有某节点对象。</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: 宋体; color: black;">之后，你就可以通过和上面相同的方法来遍历。以进一步取得其子节点的值。</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
<img src ="http://www.blogjava.net/zhyiwww/aggbug/120741.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zhyiwww/" target="_blank">zhyiwww</a> 2007-05-29 17:55 <a href="http://www.blogjava.net/zhyiwww/archive/2007/05/29/120741.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>AJAX中从远程URL动态取得xml的方法</title><link>http://www.blogjava.net/zhyiwww/archive/2007/05/14/117369.html</link><dc:creator>zhyiwww</dc:creator><author>zhyiwww</author><pubDate>Mon, 14 May 2007 08:28:00 GMT</pubDate><guid>http://www.blogjava.net/zhyiwww/archive/2007/05/14/117369.html</guid><wfw:comment>http://www.blogjava.net/zhyiwww/comments/117369.html</wfw:comment><comments>http://www.blogjava.net/zhyiwww/archive/2007/05/14/117369.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/zhyiwww/comments/commentRss/117369.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zhyiwww/services/trackbacks/117369.html</trackback:ping><description><![CDATA[
		<h2 style="text-align: center;" align="center">
				<span style="color: blue;" lang="EN-US">AJAX</span>
				<span style="font-family: 黑体; color: blue;">中从远程</span>
				<span style="color: blue;" lang="EN-US">URL</span>
				<span style="font-family: 黑体; color: blue;">动态取得</span>
				<span style="color: blue;" lang="EN-US">xml</span>
				<span style="font-family: 黑体; color: blue;">的方法</span>
				<span style="color: blue;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</h2>
		<p class="MsoPlainText">
				<b style="">
						<span style="font-size: 12pt; font-family: 黑体;">需求：<span lang="EN-US"><o:p></o:p></span></span>
				</b>
		</p>
		<p class="MsoPlainText">
				<span style="color: green;">在<span lang="EN-US">JavaScript</span>中动态的从一个<span lang="EN-US">URL</span>取得<span lang="EN-US">xml</span>文件，然后，动态的更新数据。<span lang="EN-US"><o:p></o:p></span></span>
		</p>
		<p class="MsoPlainText">
				<b style="">
						<span style="font-size: 12pt; font-family: 黑体;">问题的难点：<span lang="EN-US"><o:p></o:p></span></span>
				</b>
		</p>
		<p class="MsoPlainText">
				<span style="color: green;" lang="EN-US">Javascript</span>
				<span style="color: green;">不能实现从一个<span lang="EN-US">URL</span>读取<span lang="EN-US">xml</span>数据。<span lang="EN-US"><o:p></o:p></span></span>
		</p>
		<p class="MsoPlainText">
				<span style="color: green;">使用动态的参数的时候，如后使用<span lang="EN-US">GET</span>方法，那么，参数有可能太长。<span lang="EN-US"><o:p></o:p></span></span>
		</p>
		<p class="MsoPlainText">
				<b style="">
						<span style="font-size: 12pt; font-family: 黑体;">解决的办法：<span lang="EN-US"><o:p></o:p></span></span>
				</b>
		</p>
		<p class="MsoPlainText">
				<span style="color: green;">这个办法使用<span lang="EN-US">AJAX</span>可以实现。<span lang="EN-US"><o:p></o:p></span></span>
		</p>
		<p class="MsoPlainText">
				<span style="color: green;">因为<span lang="EN-US">AJAX</span>可以从<span lang="EN-US">URL</span>来动态的读取<span lang="EN-US">xml</span>数据。<span lang="EN-US"><o:p></o:p></span></span>
		</p>
		<p class="MsoPlainText">
				<span style="color: green;">同时也可以很方便的分析和处理<span lang="EN-US">XML</span>数据。<span lang="EN-US"><o:p></o:p></span></span>
		</p>
		<p class="MsoPlainText">
				<b style="">
						<span style="font-size: 12pt; font-family: 黑体;">问题的关键点：<span lang="EN-US"><o:p></o:p></span></span>
				</b>
		</p>
		<p class="MsoPlainText">
				<span style="color: green;" lang="EN-US">AJAX</span>
				<span style="color: green;">不能从一个不同<span lang="EN-US">Context</span>的服务器上来读入<span lang="EN-US">XML,</span>所以要想读取<span lang="EN-US">xml</span>数据的话，那就一定要在同一个<span lang="EN-US">Context</span>中，如果不在，那么就使用一个<span lang="EN-US">Servlet</span>来实现从一个远程的<span lang="EN-US">URL</span>上读取数据，然后可以通过调用此<span lang="EN-US">Servlet</span>来取得远程的数据。<span lang="EN-US"><o:p></o:p></span></span>
		</p>
		<p class="MsoPlainText">
				<b style="">
						<span style="font-size: 12pt; font-family: 黑体;">我的实现：<span lang="EN-US"><o:p></o:p></span></span>
				</b>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style=""> </span>
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style=""> </span>
				</span>
				<span style="">写一个<span lang="EN-US">Servlet</span>来实现从远程<span lang="EN-US">url</span>上读取<span lang="EN-US">xml</span>数据，这个<span lang="EN-US">url</span>参数是用户根据自己的需要传递的。<span lang="EN-US"><o:p></o:p></span></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">    </span>public void
doGet(HttpServletRequest request, HttpServletResponse response)<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">            </span>throws
ServletException, IOException {<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>System.out.println("
--------------<span style="">  </span>Get ----------------<span style="">  </span>");<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>response.setContentType("text/xml");<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>response.setCharacterEncoding("UTF-8");<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>//<span style="">      </span>PrintWriter out = response.getWriter();<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>//doPost(request,response);<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>String
url = request.getParameter("url");<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>//out.println(url);<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>//String
url = "";<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>System.out.println("url
is :<span style="">  </span>" + url);<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>//response.setContentType("text/xml");<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>PrintWriter
out = response.getWriter();<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">            </span>
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>BufferedReader
reader = new BufferedReader(new InputStreamReader(new URL(url).openStream()));<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>StringBuffer
xmlData = new StringBuffer();<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>String
tmp = "";<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>while((tmp
= reader.readLine())!=null){<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">            </span>log.info(tmp);<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">            </span>out.print(tmp);<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">            </span>//System.out.println("
tmp :<span style="">  </span>" + tmp);<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">            </span>xmlData.append(tmp);<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>}<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>try {<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">            </span>out.println(XMLUtil.format(xmlData.toString()));<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>} catch
(DocumentException e) {<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">            </span>//
TODO Auto-generated catch block<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">            </span>e.printStackTrace();<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>}<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>reader.close();<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">        </span>
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style="">    </span>}<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="" lang="EN-US">
						<span style=""> </span>
						<span style="">   </span>
				</span>
				<span style="">在<span lang="EN-US">AJAX</span>来调用<span lang="EN-US">servlet</span>取得此数据<span lang="EN-US"><o:p></o:p></span></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">       </span>
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&lt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 127, 127);" lang="EN-US">script </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 127);" lang="EN-US">type</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">=</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(42, 0, 255);" lang="EN-US">"text/javascript"</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&gt;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">           </span>
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 85);" lang="EN-US">var </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">xmlHttp=</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 85);" lang="EN-US">new </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">ActiveXObject(</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(142, 0, 255);" lang="EN-US">"Msxml2.XMLHTTP"</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">);</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">           </span>
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 95, 191);" lang="EN-US">//alert(xmlHttp);<span style="">    </span><o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 95, 191);" lang="EN-US">
						<span style="">           </span>
				</span>
				<span style="font-size: 10pt; font-family: 宋体; color: rgb(63, 95, 191);">这个</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 95, 191);" lang="EN-US">url</span>
				<span style="font-size: 10pt; font-family: 宋体; color: rgb(63, 95, 191);">是你的</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 95, 191);" lang="EN-US">servlet</span>
				<span style="font-size: 10pt; font-family: 宋体; color: rgb(63, 95, 191);">的</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 95, 191);" lang="EN-US">uri,</span>
				<span style="font-size: 10pt; font-family: 宋体; color: rgb(63, 95, 191);">只能是在同一个</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 95, 191);" lang="EN-US">context</span>
				<span style="font-size: 10pt; font-family: 宋体; color: rgb(63, 95, 191);">内的，否则不能调用。所以，如果需要跨服务器的话，或者需要跨</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 95, 191);" lang="EN-US">context</span>
				<span style="font-size: 10pt; font-family: 宋体; color: rgb(63, 95, 191);">的话，就需要使用在本</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 95, 191);" lang="EN-US">context</span>
				<span style="font-size: 10pt; font-family: 宋体; color: rgb(63, 95, 191);">上使用一个</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 95, 191);" lang="EN-US">servlet</span>
				<span style="font-size: 10pt; font-family: 宋体; color: rgb(63, 95, 191);">做跳转。</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 95, 191);" lang="EN-US">
						<span style="">
						</span>
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 95, 191);" lang="EN-US">
						<span style="">           </span>
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 85);" lang="EN-US">var </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">sevUrl = </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(142, 0, 255);" lang="EN-US">"../servlet/PullXmlData?url="</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">;</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">           </span>
						<span style=""> </span>
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">           </span>
				</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">下面的那个</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">url</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">参数其实是我们的远程的</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">xml</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">的数据的</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">url,</span>
				<span style="font-size: 10pt; font-family: 宋体; color: black;">因为在参数里面有等号，所以在调用之前就要通过一个处理和转换，这一步也是必须的。</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">           </span>
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 85);" lang="EN-US">var </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">url = sevUrl + encodeURIComponent(</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(142, 0, 255);" lang="EN-US">"http://192.168.1.50:8080/remoteServer /XmlInvoke?aaa=aaa&amp;bbb=bbb
"</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">);<span style="">     </span><o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">    </span>
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">           </span>alert(</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(142, 0, 255);" lang="EN-US">"url :<span style="">  </span>" </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">+ url);<span style="">      </span><o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">    </span>
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">           </span>xmlHttp.open(</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(142, 0, 255);" lang="EN-US">"post"</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">, url , </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 85);" lang="EN-US">false</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">);</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">           </span>xmlHttp.onreadystatechange=</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 85);" lang="EN-US">function</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">() </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 85);" lang="EN-US">{<span style="">              </span></span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 85);" lang="EN-US">
						<span style="">              </span>if </span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">(xmlHttp.readyState==4)
</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 85);" lang="EN-US">{</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 85);" lang="EN-US">
						<span style="">              </span>
						<span style="">  </span>
						<span style="">  </span>
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">alert(xmlHttp.responseText);</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">              </span>
						<span style="">   </span>
						<span style="">
						</span>document.write(xmlHttp.responseText);</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">              </span>
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 85);" lang="EN-US">}</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 85);" lang="EN-US">
						<span style="">           </span>}</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-align: left;" align="left">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 85);" lang="EN-US">
						<span style="">           </span>
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">xmlHttp.send();<span style="">      </span><span style="">       </span></span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoPlainText">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;" lang="EN-US">
						<span style="">       </span>
				</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&lt;/</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 127, 127);" lang="EN-US">script</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">&gt;<o:p></o:p></span>
		</p>
		<p class="MsoPlainText">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">
						<span style="">       </span>
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoPlainText">
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">
						<span style="">       </span>
				</span>
				<span style="font-size: 10pt; color: teal;">我也刚接触</span>
				<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">Ajax,</span>
				<span style="font-size: 10pt; color: teal;">所以也只能想到这个解决方案，如果大家有好的解决办法，还请多多指教。</span>
				<span style="" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
<img src ="http://www.blogjava.net/zhyiwww/aggbug/117369.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zhyiwww/" target="_blank">zhyiwww</a> 2007-05-14 16:28 <a href="http://www.blogjava.net/zhyiwww/archive/2007/05/14/117369.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>javascript鼠标拉框（框选）的实现</title><link>http://www.blogjava.net/zhyiwww/archive/2007/04/03/108217.html</link><dc:creator>zhyiwww</dc:creator><author>zhyiwww</author><pubDate>Tue, 03 Apr 2007 08:04:00 GMT</pubDate><guid>http://www.blogjava.net/zhyiwww/archive/2007/04/03/108217.html</guid><wfw:comment>http://www.blogjava.net/zhyiwww/comments/108217.html</wfw:comment><comments>http://www.blogjava.net/zhyiwww/archive/2007/04/03/108217.html#Feedback</comments><slash:comments>7</slash:comments><wfw:commentRss>http://www.blogjava.net/zhyiwww/comments/commentRss/108217.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zhyiwww/services/trackbacks/108217.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: javascript实现框选，拉框。解决了拖拽拉框、矩形拉框的问题。这个功能主要用在地图的拉框放大和拉框缩小。也可以用在其它的需要拉框选择的地方。<br>也是我在做地图的拉框放大和拉框缩小的时候遇到的问题。<br>主要问题是，在鼠标移动的时候，不能响应mouseup事件。解决鼠标在移动的时候不能响应鼠标抬起事件的问题。&nbsp;&nbsp;<a href='http://www.blogjava.net/zhyiwww/archive/2007/04/03/108217.html'>阅读全文</a><img src ="http://www.blogjava.net/zhyiwww/aggbug/108217.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zhyiwww/" target="_blank">zhyiwww</a> 2007-04-03 16:04 <a href="http://www.blogjava.net/zhyiwww/archive/2007/04/03/108217.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>