﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-从点点滴滴改变-随笔分类-编程学习笔记</title><link>http://www.cnitblog.com/chibohua/category/3115.html</link><description>生活是美好的!</description><language>zh-cn</language><lastBuildDate>Thu, 29 Sep 2011 11:38:58 GMT</lastBuildDate><pubDate>Thu, 29 Sep 2011 11:38:58 GMT</pubDate><ttl>60</ttl><item><title>URL编码方法的比较</title><link>http://www.cnitblog.com/chibohua/archive/2006/08/09/15006.html</link><dc:creator>抱着太阳跳舞</dc:creator><author>抱着太阳跳舞</author><pubDate>Wed, 09 Aug 2006 05:40:00 GMT</pubDate><guid>http://www.cnitblog.com/chibohua/archive/2006/08/09/15006.html</guid><wfw:comment>http://www.cnitblog.com/chibohua/comments/15006.html</wfw:comment><comments>http://www.cnitblog.com/chibohua/archive/2006/08/09/15006.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/chibohua/comments/commentRss/15006.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/chibohua/services/trackbacks/15006.html</trackback:ping><description><![CDATA[
		<h2>
				<a class="entrytitlelist" title="URL编码方法的比较" href="http://www.zeali.net/entry/160" rel="bookmark">
				</a> </h2>
		<div class="modcontent">
				<div id="entry_introduce">
						<div class="entry_introduce">javascript中存在几种对URL字符串进行编码的方法：escape()，encodeURI()，以及encodeURIComponent()。这几种编码所起的作用各不相同。</div>
				</div>
				<div id="entryBody">
						<p style="FONT-WEIGHT: bold; FONT-SIZE: 14px">escape() 方法： </p>
						<p>采用ISO Latin字符集对指定的字符串进行编码。所有的空格符、标点符号、特殊字符以及其他非ASCII字符都将被转化成%xx格式的字符编码（xx等于该字符在字符集表里面的编码的16进制数字）。比如，空格符对应的编码是%20。</p>
						<p>不会被此方法编码的字符： <font style="COLOR: black; BACKGROUND-COLOR: #e4e4e4">@ * / +</font></p>
						<p style="FONT-WEIGHT: bold; FONT-SIZE: 14px">encodeURI() 方法：</p>
						<p>把URI字符串采用UTF-8编码格式转化成escape格式的字符串。</p>
						<p>不会被此方法编码的字符：<font style="COLOR: black; BACKGROUND-COLOR: #e4e4e4">! @ # $&amp; * ( ) = : / ; ? + '</font></p>
						<p style="FONT-WEIGHT: bold; FONT-SIZE: 14px">encodeURIComponent() 方法：</p>
						<p>把URI字符串采用UTF-8编码格式转化成escape格式的字符串。与encodeURI()相比，这个方法将对更多的字符进行编码，比如 / 等字符。所以如果字符串里面包含了URI的几个部分的话，不能用这个方法来进行编码，否则 / 字符被编码之后URL将显示错误。</p>
						<p>不会被此方法编码的字符：<font style="COLOR: black; BACKGROUND-COLOR: #e4e4e4">! * ( ) '</font></p>
						<p>因此，对于中文字符串来说，如果不希望把字符串编码格式转化成UTF-8格式的（比如原页面和目标页面的charset是一致的时候），只需要使用escape。如果你的页面是GB2312或者其他的编码，而接受参数的页面是UTF-8编码的，就要采用encodeURI或者encodeURIComponent。</p>
						<p>另外，encodeURI/encodeURIComponent是在javascript1.5之后引进的，escape则在javascript1.0版本就有。</p>
				</div>
		</div>
<img src ="http://www.cnitblog.com/chibohua/aggbug/15006.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/chibohua/" target="_blank">抱着太阳跳舞</a> 2006-08-09 13:40 <a href="http://www.cnitblog.com/chibohua/archive/2006/08/09/15006.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>javascript之ActiveXObject("Scripting.Dictionary")用法小例</title><link>http://www.cnitblog.com/chibohua/archive/2006/06/15/12292.html</link><dc:creator>抱着太阳跳舞</dc:creator><author>抱着太阳跳舞</author><pubDate>Thu, 15 Jun 2006 03:32:00 GMT</pubDate><guid>http://www.cnitblog.com/chibohua/archive/2006/06/15/12292.html</guid><wfw:comment>http://www.cnitblog.com/chibohua/comments/12292.html</wfw:comment><comments>http://www.cnitblog.com/chibohua/archive/2006/06/15/12292.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/chibohua/comments/commentRss/12292.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/chibohua/services/trackbacks/12292.html</trackback:ping><description><![CDATA[说明：个人理解Scripting.Dictionary创建的对象，它的集合中每一项包含两个属性一个是键值，一个是值，即（key，value），其中value可以是任何类型的对象或数值。<br /><br />&lt;script language = javascript&gt;<br /> function ok(){<br />  try{<br />   var obj = new ActiveXObject("Scripting.Dictionary");//创建对象<br />   obj.Add("hello",null);//增加新项<br />   obj.Item("hello")="Chiweiyao";//给新增添的项赋值<br />   obj.Add("world",null);<br />   obj.Item("world")="Greate";<br />   <br />   var keys=obj.Keys().toArray();//将obj对象的键值转换成数组<br />   for(var i = 0;i&lt;keys.length;i++){<br />       if(obj.Exists(keys[i])){//判断对象集合中是否存在指定键值的项<br />        obj.Item(keys[i])=null;<br />        obj.Remove(keys[i]);//删除指定键值项<br />       }<br />   } <br />  }<br />  catch(e)<br />  {<br />   alert(e.message);<br />  }<br /> }<br />&lt;/script&gt;<img src ="http://www.cnitblog.com/chibohua/aggbug/12292.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/chibohua/" target="_blank">抱着太阳跳舞</a> 2006-06-15 11:32 <a href="http://www.cnitblog.com/chibohua/archive/2006/06/15/12292.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>javascript之ActiveXObject（创建Excel）</title><link>http://www.cnitblog.com/chibohua/archive/2006/06/15/12291.html</link><dc:creator>抱着太阳跳舞</dc:creator><author>抱着太阳跳舞</author><pubDate>Thu, 15 Jun 2006 03:01:00 GMT</pubDate><guid>http://www.cnitblog.com/chibohua/archive/2006/06/15/12291.html</guid><wfw:comment>http://www.cnitblog.com/chibohua/comments/12291.html</wfw:comment><comments>http://www.cnitblog.com/chibohua/archive/2006/06/15/12291.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.cnitblog.com/chibohua/comments/commentRss/12291.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/chibohua/services/trackbacks/12291.html</trackback:ping><description><![CDATA[
		<p>JScript 8.0  （转载msdn）<br />ActiveXObject 对象  </p>
		<p>此对象提供自动化对象的接口。</p>
		<p>function ActiveXObject(ProgID : String [, location : String])<br />参数</p>
		<p>ProgID<br />必选。形式为“serverName.typeName”的字符串，其中 serverName 是提供对象的应用程序的名称，typeName 是要创建的对象的类型或类。</p>
		<p>location<br />可选项。要在其中创建对象的网络访问器的名称。</p>
		<p>备注</p>
		<p>通常，自动化服务器会提供至少一种对象。例如，字处理应用程序可能会提供应用程序对象、文档对象和工具栏对象。</p>
		<p>以下代码通过调用 ActiveXObject 对象构造函数来启动应用程序（在这种情况下为 Microsoft Excel 工作表）。ActiveXObject 允许您在代码中引用应用程序。使用下面的示例，您可以使用对象变量 ExcelSheet 和其他 Excel 对象（包括应用程序对象和 ActiveSheet.Cells 集合）来访问新对象的属性和方法。</p>
		<p>// Declare the variables<br />var Excel, Book;</p>
		<p>// Create the Excel application object.<br />Excel = new ActiveXObject("Excel.Application");</p>
		<p>// Make Excel visible.<br />Excel.Visible = true;</p>
		<p>// Create a new work book.<br />Book = Excel.Workbooks.Add()</p>
		<p>// Place some text in the first cell of the sheet.<br />Book.ActiveSheet.Cells(1,1).Value = "This is column A, row 1";</p>
		<p>// Save the sheet.<br />Book.SaveAs("C:\\TEST.XLS");</p>
		<p>// Close Excel with the Quit method on the Application object.<br />Excel.Application.Quit();<br />若要在远程服务器上创建对象，只能在关闭 Internet 安全机制时完成。您可以通过将计算机的名称传递到 ActiveXObject 的 servername 参数在远程网络计算机上创建对象。该名称与共享名的计算机名部分相同。对于名为“\\MyServer\public”的网络共享，servername 为“MyServer”。此外，您可以使用 DNS 格式或 IP 地址来指定 servername。</p>
		<p>以下代码返回在名为“MyServer”的远程网络计算机上运行的 Excel 实例的版本号：</p>
		<p>function GetAppVersion() {<br />   var Excel = new ActiveXObject("Excel.Application", "MyServer");<br />   return(Excel.Version);<br />}<br />如果指定的远程服务器不存在或者找不到，则会出错。<br /></p>
<img src ="http://www.cnitblog.com/chibohua/aggbug/12291.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/chibohua/" target="_blank">抱着太阳跳舞</a> 2006-06-15 11:01 <a href="http://www.cnitblog.com/chibohua/archive/2006/06/15/12291.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>