<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>评论：JavaScript的陷阱</title>
	<atom:link href="http://dancewithnet.com/2008/10/27/javascript-gotchas/feed/" rel="self" type="application/rss+xml" />
	<link>http://dancewithnet.com/2008/10/27/javascript-gotchas/</link>
	<description>WEB Design{HTML:CSS:Javascript:DOM:AJAX:PHP:Usability}/Viewpoint/Photo/Food/Mood</description>
	<lastBuildDate>Sat, 13 Mar 2010 07:52:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>来自：Physure.com &#187; [转]JavaScript的陷阱</title>
		<link>http://dancewithnet.com/2008/10/27/javascript-gotchas/comment-page-1/#comment-226303</link>
		<dc:creator>Physure.com &#187; [转]JavaScript的陷阱</dc:creator>
		<pubDate>Fri, 05 Feb 2010 16:17:56 +0000</pubDate>
		<guid isPermaLink="false">http://dancewithnet.com/?p=1366#comment-226303</guid>
		<description>[...] http://dancewithnet.com/ [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://dancewithnet.com/" rel="nofollow">http://dancewithnet.com/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：匿名</title>
		<link>http://dancewithnet.com/2008/10/27/javascript-gotchas/comment-page-1/#comment-223526</link>
		<dc:creator>匿名</dc:creator>
		<pubDate>Mon, 21 Dec 2009 06:59:26 +0000</pubDate>
		<guid isPermaLink="false">http://dancewithnet.com/?p=1366#comment-223526</guid>
		<description>麻烦您看一下，这个在IE老是报31行缺少&#039;;&#039;错误




Insert title here

function getSheetData(oSheet){
		alert(&quot;alert&quot;);
	var rowcount=oSheet.UsedRange.Cells.Rows.Count;
	var colcount=oSheet.UsedRange.Columns.Count;
	var sheetData = new Array();
	for(var i=1;i&lt;rowcount;i++){
		if(oSheet.Cells(i,1).value==undefined&#124;&#124;oSheet.Cells(i,1).value==&quot;&quot;) continue;
		var rowData = new Array();
		
		for(j=1;j&lt;colcount;j++){
				if(oSheet.Cells(1,j).value==undefined&#124;&#124;oSheet.Cells(1,j).value==&quot;&quot;) continue;
				rowData[j-1]=oSheet.Cells(i,j).value;
			}
			sheetData[i-1]=rowData;
		}
		return 	sheetData;
} 
function readExcel(filePath){
	filePath=filePath.replace(&quot;\\&quot;,&quot;\\\\&quot;);
  	var oXL = new ActiveXObject(&quot;Excel.Application&quot;);    
  	var oWB = oXL.Workbooks.open(filePath);   
  	oWB.worksheets(&quot;new&quot;).activate;  
	var oSheet = oWB.ActiveSheet;
	alert(&quot;alert&quot;);
	var newSheetData = getSheetData(oSheet);
	oWB.worksheets(&quot;old&quot;).activate;  		
	var oldSheet = oWB.ActiveSheet;
	var oldSheetData = getSheetData(oldSheet);
	var resultSheetData = new Array();
	resultSheetData[0] = newSheetData[0];
	for(int i=1; i &lt; newSheetData.length; i++){
		var resultRowData = new Array();
		var searchNo = newSheetData[i][0];
		var oldRow = getOldIndex(searchNo,oldSheetData);
		if(oldRow!= -1){
				resultRowData = getResultRowData(resultSheetData[0].length,newSheetData[i],oldSheetData[oldRow]);
			}else{
				resultRowData = newSheetData[i];
			}
			resultSheetData[i] = resultRowData;
	}
	var oWB = oXL.Workbooks.Add(&quot;result&quot;);
	oWB.worksheets(&quot;result&quot;).activate;
	var resultSheet = oWB.ActiveSheet;
	for(int i=0;i&lt;resultSheetData.length;i++){
		for(int j=0;j&lt;resultSheetData[i].length;j++){
				oSheet.Cells(i+1,j+1).value = resultSheetData[i][j];
			}
	}
	oWB.save();
	oWB.close();  
}

function getResultRowData(newCol,oldRowData,newRowData){
		alert(&quot;alert&quot;);
		var resultRowData = new Array();
		for(int i=0;i&lt;newRowData.length;i++){
				if((newRowData[i]==undefined&#124;&#124;newRowData[i]==&quot;&quot;)&amp;&amp;i&lt;newCol-1){
						resultRowData[i] = oldRowData[i];
					}else{
							resultRowData[i] = newRowData[i];
						}
			}
}
function getOldIndex(searchNo,oldSheetData){
		alert(&quot;alert&quot;);
	for(int i=0;i&lt;oldSheetData.length;i++){
			if(searchNo==oldSheetData[i]){
				return i;
			}
		}
		return -1;
}








我的邮箱是gyl_sky_2005@yahoo.com.cn</description>
		<content:encoded><![CDATA[<p>麻烦您看一下，这个在IE老是报31行缺少&#8217;;'错误</p>
<p>Insert title here</p>
<p>function getSheetData(oSheet){<br />
		alert(&#8220;alert&#8221;);<br />
	var rowcount=oSheet.UsedRange.Cells.Rows.Count;<br />
	var colcount=oSheet.UsedRange.Columns.Count;<br />
	var sheetData = new Array();<br />
	for(var i=1;i&lt;rowcount;i++){<br />
		if(oSheet.Cells(i,1).value==undefined||oSheet.Cells(i,1).value==&quot;&quot;) continue;<br />
		var rowData = new Array();</p>
<p>		for(j=1;j&lt;colcount;j++){<br />
				if(oSheet.Cells(1,j).value==undefined||oSheet.Cells(1,j).value==&quot;&quot;) continue;<br />
				rowData[j-1]=oSheet.Cells(i,j).value;<br />
			}<br />
			sheetData[i-1]=rowData;<br />
		}<br />
		return 	sheetData;<br />
}<br />
function readExcel(filePath){<br />
	filePath=filePath.replace(&quot;\\&quot;,&quot;\\\\&quot;);<br />
  	var oXL = new ActiveXObject(&quot;Excel.Application&quot;);<br />
  	var oWB = oXL.Workbooks.open(filePath);<br />
  	oWB.worksheets(&quot;new&quot;).activate;<br />
	var oSheet = oWB.ActiveSheet;<br />
	alert(&quot;alert&quot;);<br />
	var newSheetData = getSheetData(oSheet);<br />
	oWB.worksheets(&quot;old&quot;).activate;<br />
	var oldSheet = oWB.ActiveSheet;<br />
	var oldSheetData = getSheetData(oldSheet);<br />
	var resultSheetData = new Array();<br />
	resultSheetData[0] = newSheetData[0];<br />
	for(int i=1; i &lt; newSheetData.length; i++){<br />
		var resultRowData = new Array();<br />
		var searchNo = newSheetData[i][0];<br />
		var oldRow = getOldIndex(searchNo,oldSheetData);<br />
		if(oldRow!= -1){<br />
				resultRowData = getResultRowData(resultSheetData[0].length,newSheetData[i],oldSheetData[oldRow]);<br />
			}else{<br />
				resultRowData = newSheetData[i];<br />
			}<br />
			resultSheetData[i] = resultRowData;<br />
	}<br />
	var oWB = oXL.Workbooks.Add(&quot;result&quot;);<br />
	oWB.worksheets(&quot;result&quot;).activate;<br />
	var resultSheet = oWB.ActiveSheet;<br />
	for(int i=0;i&lt;resultSheetData.length;i++){<br />
		for(int j=0;j&lt;resultSheetData[i].length;j++){<br />
				oSheet.Cells(i+1,j+1).value = resultSheetData[i][j];<br />
			}<br />
	}<br />
	oWB.save();<br />
	oWB.close();<br />
}</p>
<p>function getResultRowData(newCol,oldRowData,newRowData){<br />
		alert(&quot;alert&quot;);<br />
		var resultRowData = new Array();<br />
		for(int i=0;i&lt;newRowData.length;i++){<br />
				if((newRowData[i]==undefined||newRowData[i]==&quot;&quot;)&amp;&amp;i&lt;newCol-1){<br />
						resultRowData[i] = oldRowData[i];<br />
					}else{<br />
							resultRowData[i] = newRowData[i];<br />
						}<br />
			}<br />
}<br />
function getOldIndex(searchNo,oldSheetData){<br />
		alert(&quot;alert&quot;);<br />
	for(int i=0;i&lt;oldSheetData.length;i++){<br />
			if(searchNo==oldSheetData[i]){<br />
				return i;<br />
			}<br />
		}<br />
		return -1;<br />
}</p>
<p>我的邮箱是gyl_sky_2005@yahoo.com.cn</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：Supersha</title>
		<link>http://dancewithnet.com/2008/10/27/javascript-gotchas/comment-page-1/#comment-222572</link>
		<dc:creator>Supersha</dc:creator>
		<pubDate>Mon, 07 Dec 2009 09:02:09 +0000</pubDate>
		<guid isPermaLink="false">http://dancewithnet.com/?p=1366#comment-222572</guid>
		<description>在《Javascript语言精粹》里论述了其中的一些，这里的更加详细，一个好的编写js风格的习惯非常重要~</description>
		<content:encoded><![CDATA[<p>在《Javascript语言精粹》里论述了其中的一些，这里的更加详细，一个好的编写js风格的习惯非常重要~</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：JavaScript的陷阱</title>
		<link>http://dancewithnet.com/2008/10/27/javascript-gotchas/comment-page-1/#comment-219736</link>
		<dc:creator>JavaScript的陷阱</dc:creator>
		<pubDate>Mon, 09 Nov 2009 08:01:22 +0000</pubDate>
		<guid isPermaLink="false">http://dancewithnet.com/?p=1366#comment-219736</guid>
		<description>[...] 阅读全文：JavaScript的陷阱 [...]</description>
		<content:encoded><![CDATA[<p>[...] 阅读全文：JavaScript的陷阱 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：JavaScript的陷阱 - Yaohaixiao&#8217;g Blog</title>
		<link>http://dancewithnet.com/2008/10/27/javascript-gotchas/comment-page-1/#comment-170363</link>
		<dc:creator>JavaScript的陷阱 - Yaohaixiao&#8217;g Blog</dc:creator>
		<pubDate>Wed, 08 Apr 2009 08:43:49 +0000</pubDate>
		<guid isPermaLink="false">http://dancewithnet.com/?p=1366#comment-170363</guid>
		<description>[...] 作者：Estelle Weyl 原文：15 JavaScript Gotchas 翻译：随网之舞 [...]</description>
		<content:encoded><![CDATA[<p>[...] 作者：Estelle Weyl 原文：15 JavaScript Gotchas 翻译：随网之舞 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：z.Yleo77</title>
		<link>http://dancewithnet.com/2008/10/27/javascript-gotchas/comment-page-1/#comment-162983</link>
		<dc:creator>z.Yleo77</dc:creator>
		<pubDate>Tue, 09 Dec 2008 07:33:58 +0000</pubDate>
		<guid isPermaLink="false">http://dancewithnet.com/?p=1366#comment-162983</guid>
		<description>this这一块看的不是很明白， 先记下  查查资料</description>
		<content:encoded><![CDATA[<p>this这一块看的不是很明白， 先记下  查查资料</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：取水楼</title>
		<link>http://dancewithnet.com/2008/10/27/javascript-gotchas/comment-page-1/#comment-161635</link>
		<dc:creator>取水楼</dc:creator>
		<pubDate>Wed, 29 Oct 2008 15:40:32 +0000</pubDate>
		<guid isPermaLink="false">http://dancewithnet.com/?p=1366#comment-161635</guid>
		<description>完全初学....

switch 居然是强类型...我汗...</description>
		<content:encoded><![CDATA[<p>完全初学&#8230;.</p>
<p>switch 居然是强类型&#8230;我汗&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：秦歌</title>
		<link>http://dancewithnet.com/2008/10/27/javascript-gotchas/comment-page-1/#comment-161625</link>
		<dc:creator>秦歌</dc:creator>
		<pubDate>Wed, 29 Oct 2008 01:40:24 +0000</pubDate>
		<guid isPermaLink="false">http://dancewithnet.com/?p=1366#comment-161625</guid>
		<description>To Airex：我的理解是作者把For Each看着是使用For关键字循环的统称。另外，JavaScript1.6中增加了Array.forEach()，至少在Firefox1.5以上能看到，很多的JavaScript库都有类似的通用解决方案。</description>
		<content:encoded><![CDATA[<p>To Airex：我的理解是作者把For Each看着是使用For关键字循环的统称。另外，JavaScript1.6中增加了Array.forEach()，至少在Firefox1.5以上能看到，很多的JavaScript库都有类似的通用解决方案。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：Ariex</title>
		<link>http://dancewithnet.com/2008/10/27/javascript-gotchas/comment-page-1/#comment-161619</link>
		<dc:creator>Ariex</dc:creator>
		<pubDate>Tue, 28 Oct 2008 19:04:41 +0000</pubDate>
		<guid isPermaLink="false">http://dancewithnet.com/?p=1366#comment-161619</guid>
		<description>博主的态度让我觉得我很白痴，嗯嗯……
另外，js没有foreach方法，只有for in，原文貌似也是这样写的……</description>
		<content:encoded><![CDATA[<p>博主的态度让我觉得我很白痴，嗯嗯……<br />
另外，js没有foreach方法，只有for in，原文貌似也是这样写的……</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：秦歌</title>
		<link>http://dancewithnet.com/2008/10/27/javascript-gotchas/comment-page-1/#comment-161607</link>
		<dc:creator>秦歌</dc:creator>
		<pubDate>Tue, 28 Oct 2008 10:54:47 +0000</pubDate>
		<guid isPermaLink="false">http://dancewithnet.com/?p=1366#comment-161607</guid>
		<description>To MarVell：已经修正，多谢。
To Ariex：
1、if语句的问题你到提醒了我，呵呵，我现在把执行块写在大括号中作为强烈建议。多谢，多谢。不过你那句从vb到c的说法，很值得玩味。
2、for那个的确表述的不对，作者用了For Each，我当时没多想就直接用了for语句，现在已经换了一种说法，多谢。</description>
		<content:encoded><![CDATA[<p>To MarVell：已经修正，多谢。<br />
To Ariex：<br />
1、if语句的问题你到提醒了我，呵呵，我现在把执行块写在大括号中作为强烈建议。多谢，多谢。不过你那句从vb到c的说法，很值得玩味。<br />
2、for那个的确表述的不对，作者用了For Each，我当时没多想就直接用了for语句，现在已经换了一种说法，多谢。</p>
]]></content:encoded>
	</item>
</channel>
</rss>
