<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Little Fox is Learning &#187; IE</title>
	<atom:link href="http://corababy.net/tech/tag/ie/feed/" rel="self" type="application/rss+xml" />
	<link>http://corababy.net/tech</link>
	<description>People are designed for lots of things, but loneliness isn&#039;t one of them.</description>
	<lastBuildDate>Wed, 24 Mar 2010 16:53:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>关于split(), 那些被我们遗忘的</title>
		<link>http://corababy.net/tech/2009/07/27/%e5%85%b3%e4%ba%8esplit-%e9%82%a3%e4%ba%9b%e8%a2%ab%e6%88%91%e4%bb%ac%e9%81%97%e5%bf%98%e7%9a%84/</link>
		<comments>http://corababy.net/tech/2009/07/27/%e5%85%b3%e4%ba%8esplit-%e9%82%a3%e4%ba%9b%e8%a2%ab%e6%88%91%e4%bb%ac%e9%81%97%e5%bf%98%e7%9a%84/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 14:38:40 +0000</pubDate>
		<dc:creator>little fox</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[split]]></category>
		<category><![CDATA[竖排]]></category>

		<guid isPermaLink="false">http://corababy.net/tech/?p=6</guid>
		<description><![CDATA[
为&#8221;Little fox is learning&#8221;写皮肤的时候, 在widget title文字竖排的问题上还真的是耗费了很多精神在里面.
其实, 网路上有很多老师讲解关于如何对文字进行竖排版的方法, 但是, 大部分是针对于中文, 为了解决古代诗词排版的难题, 可是, 对英文来讲, 似乎找不到太过对症的办法, 所以还是自己摸索着写了.
本质上需要解决的问题仅仅是, 如何将字符串转化为数组, 前提是没有任何可以供分割的字符, 比如&#8221;;&#8221;, 或者&#8221;,&#8221;.
开始的时候是这样写的:

var i,strCount, tempStr;
tempStr = '';
strCount = inputStr.length;
for (i = 0; i &#38;lt; strCount; i ++) {
  tempStr += inputStr[i] + '&#38;amp;nbsp;';
}
document.write(tempStr);

这样写会错么? 会, 也不会.
当然, firefox, chrome, safari, opera, IE8 都是会通过的, 但是, IE6, 7 却不能够保证.
因为当用compatible view查看的时候发现, 所有的&#8221;inputStr[i]&#8220;都是&#8221;undefined&#8221;.
IE6, 7是无法识别一个字符串作为数组使用么?
也许是.
所以才惊奇的发现了split()的被遗忘掉的功用性.

strCount = [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-10" title="widget title on the right" src="http://corababy.net/tech/wp-content/uploads/2009/07/Capture.JPG" alt="widget title on the right" width="65" height="138" /></p>
<p>为&#8221;Little fox is learning&#8221;写皮肤的时候, 在widget title文字竖排的问题上还真的是耗费了很多精神在里面.</p>
<p>其实, 网路上有很多老师讲解关于如何对文字进行竖排版的方法, 但是, 大部分是针对于中文, 为了解决古代诗词排版的难题, 可是, 对英文来讲, 似乎找不到太过对症的办法, 所以还是自己摸索着写了.</p>
<p>本质上需要解决的问题仅仅是, 如何将字符串转化为数组, 前提是没有任何可以供分割的字符, 比如&#8221;;&#8221;, 或者&#8221;,&#8221;.</p>
<p>开始的时候是这样写的:</p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">var i,strCount, tempStr;
tempStr = '';
strCount = inputStr.length;
for (i = 0; i &amp;lt; strCount; i ++) {
  tempStr += inputStr[i] + '&amp;amp;nbsp;';
}
document.write(tempStr);</pre></div></div>

<p>这样写会错么? 会, 也不会.</p>
<p>当然, firefox, chrome, safari, opera, IE8 都是会通过的, 但是, IE6, 7 却不能够保证.</p>
<p>因为当用compatible view查看的时候发现, 所有的&#8221;inputStr[i]&#8220;都是&#8221;undefined&#8221;.</p>
<p>IE6, 7是无法识别一个字符串作为数组使用么?</p>
<p>也许是.</p>
<p>所以才惊奇的发现了split()的被遗忘掉的功用性.</p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">strCount = inputStr.length;
tempStr ='';
strArray = str.split('');
for (i=0; i&amp;lt; strCount ; i++) {
  tempStr += strArray[i] +  '&amp;amp;nbsp;';
}</pre></div></div>

<p>这样的方式在IE6,7下也是被通过的, 看来, IE6,7对于js object的要求应该算是苛刻的么?</p>
<p>如果你知道其中原因就告诉我吧.</p>
<p><span style="color: #daec12;"><strong>++好孩子珊瑚++</strong></span></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fcorababy.net%2Ftech%2F2009%2F07%2F27%2F%25e5%2585%25b3%25e4%25ba%258esplit-%25e9%2582%25a3%25e4%25ba%259b%25e8%25a2%25ab%25e6%2588%2591%25e4%25bb%25ac%25e9%2581%2597%25e5%25bf%2598%25e7%259a%2584%2F&amp;linkname=%E5%85%B3%E4%BA%8Esplit%28%29%2C%20%E9%82%A3%E4%BA%9B%E8%A2%AB%E6%88%91%E4%BB%AC%E9%81%97%E5%BF%98%E7%9A%84"><img src="http://corababy.net/tech/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://corababy.net/tech/2009/07/27/%e5%85%b3%e4%ba%8esplit-%e9%82%a3%e4%ba%9b%e8%a2%ab%e6%88%91%e4%bb%ac%e9%81%97%e5%bf%98%e7%9a%84/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
