<?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>枫芸志 &#187; 网页设计</title>
	<atom:link href="http://witmax.cn/category/webdesign/feed" rel="self" type="application/rss+xml" />
	<link>http://witmax.cn</link>
	<description>记录成长路途上的点滴总结</description>
	<lastBuildDate>Thu, 09 Feb 2012 14:23:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>【Javascript】Bing翻译API使用代码实例</title>
		<link>http://witmax.cn/js-bing-translation-api-demo.html</link>
		<comments>http://witmax.cn/js-bing-translation-api-demo.html#comments</comments>
		<pubDate>Tue, 07 Feb 2012 14:07:13 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[网页设计]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=1950</guid>
		<description><![CDATA[因为Google翻译API改成收费的了，于是改用Bing的翻译服务了。 Bing翻译API的使用代码如下： 是不是很简单？ 其他的Bing翻译API见这里。]]></description>
			<content:encoded><![CDATA[<p>因为Google翻译API改成收费的了，于是改用Bing的翻译服务了。</p>
<p>Bing翻译API的使用代码如下：</p>
<p><span id="more-1950"></span></p>
<pre class="brush: plain; title: ; notranslate">var bingAppId = 'xxx'; //bingAppId需替换为自己的，在https://ssl.bing.com/webmaster/Developers/AppIds/申请
function bingDetectCallback(response){
    if (response == ''){
        alert(&quot;翻译服务不可用&quot;);
        return;
    }
    var text = document.getElementById(&quot;sentence_content&quot;).innerHTML;
    var languageFrom = (response=='en' ? 'en' : 'zh-CHS');
    var languageTo = (response=='zh-CHS' ? 'en' : 'zh-CHS');
    var url = &quot;http://api.microsofttranslator.com/V2/Ajax.svc/Translate?oncomplete=bingTranslateCallbak&quot;+&quot;&amp;appId=&quot;+ encodeURIComponent(bingAppId) + &quot;&amp;from=&quot; + languageFrom + &quot;&amp;to=&quot; + languageTo + &quot;&amp;text=&quot; + text;
    request(url);
}
function bingTranslateCallbak(response){
    alert(response);
}
function request(url){
    var s = document.createElement(&quot;script&quot;);
    s.src = url;
    document.getElementsByTagName(&quot;head&quot;)[0].appendChild(s);
}
function bingTranslate(){
    var text = '需要翻译的文本';
    var url = &quot;http://api.microsofttranslator.com/V2/Ajax.svc/Detect?oncomplete=bingDetectCallback&quot;+&quot;&amp;appId=&quot; + encodeURIComponent(bingAppId) + &quot;&amp;text=&quot; + text;
    request(url);
}
bingTranslate();</pre>
<p>是不是很简单？</p>
<p>其他的Bing翻译API见<a href="http://msdn.microsoft.com/en-us/library/ff512404.aspx" target="_blank">这里</a>。</p>
]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/js-bing-translation-api-demo.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【Javascript】利用document.domain解决子域跨域访问问题</title>
		<link>http://witmax.cn/js-cross-subdomain.html</link>
		<comments>http://witmax.cn/js-cross-subdomain.html#comments</comments>
		<pubDate>Sun, 08 Jan 2012 08:46:03 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[网页设计]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=1890</guid>
		<description><![CDATA[根据浏览器安全策略，不同域名（比如witmax.cn和www.witmax.cn）、不同协议（比如http://witmax.cn和https://witmax.cn）、不同端口（比如http://witmax.cn和http://witmax.cn:8088）之间的页面不能相互访问，包括XMLHTTPRequest方式和Javascript的页面访问。 有一个例外是：在相同根域、相同协议、相同端口的情况下，可以利用设置document.domain方式来解决不同子域的跨站访问问题。 举个例子，想在witmax.cn中，访问www.witmax.cn域名下的内容，需要以下几步来完成： 在主页面（位于witmax.cn中）通过隐藏的iframe嵌套子页面（内容位于www.witmax.cn） 在主页面中设置document.domain=”witmax.cn”; 在子页面中设置document.domain=”witmax.cn”; 在主页面和子页面中可以相互访问内容了；需要跨域访问其他内容，可以通过在对应页面上发请求完成取回数据然后进行对应操作 P.S. 补充几点： 1、document.domain可以由子域www.witmax.cn修改为主域witmax.cn，而不能由witmax.cn修改为www.witmax.cn（不是所有浏览器都支持）。 2、不同根域、或不同协议、或不同端口之间的跨域访问只能通过服务器断的代理程序来解决了。 3、详细的示例见参考文档： 用document.domain解决Ajax跨子域 用document.domain+iframe实现Ajax跨子域 设置 iframe document.domain杂谈]]></description>
			<content:encoded><![CDATA[<p>根据浏览器安全策略，不同域名（比如witmax.cn和www.witmax.cn）、不同协议（比如http://witmax.cn和https://witmax.cn）、不同端口（比如http://witmax.cn和http://witmax.cn:8088）之间的页面不能相互访问，包括XMLHTTPRequest方式和Javascript的页面访问。</p>
<p>有一个例外是：<strong>在相同根域、相同协议、相同端口的情况下，可以利用设置document.domain方式来解决不同子域的跨站访问问题。</strong></p>
<p>举个例子，想在witmax.cn中，访问www.witmax.cn域名下的内容，需要以下几步来完成：</p>
<p><span id="more-1890"></span></p>
<ol>
<li>在主页面（位于witmax.cn中）通过隐藏的iframe嵌套子页面（内容位于www.witmax.cn）</li>
<li>在主页面中设置document.domain=”witmax.cn”;</li>
<li>在子页面中设置document.domain=”witmax.cn”;</li>
<li>在主页面和子页面中可以相互访问内容了；需要跨域访问其他内容，可以通过在对应页面上发请求完成取回数据然后进行对应操作</li>
</ol>
<p>P.S. 补充几点：</p>
<p>1、document.domain可以由子域<a href="http://www.witmax.cn">www.witmax.cn</a>修改为主域witmax.cn，而不能由witmax.cn修改为<a href="http://www.witmax.cn">www.witmax.cn</a>（不是所有浏览器都支持）。</p>
<p>2、不同根域、或不同协议、或不同端口之间的跨域访问只能通过服务器断的代理程序来解决了。</p>
<p>3、详细的示例见参考文档：</p>
<ul>
<li><a href="http://dancewithnet.com/2007/07/22/solve-cross-sub-domain-ajax-with-document-domain/" target="_blank">用document.domain解决Ajax跨子域</a></li>
<li><a href="http://js8.in/443.html" target="_blank">用document.domain+iframe实现Ajax跨子域</a></li>
<li><a href="http://lixinlixin2008.iteye.com/blog/515352" target="_blank">设置 iframe document.domain杂谈</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/js-cross-subdomain.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>《HTML5设计原理》笔记</title>
		<link>http://witmax.cn/html5-design-principles-notes.html</link>
		<comments>http://witmax.cn/html5-design-principles-notes.html#comments</comments>
		<pubDate>Thu, 05 Jan 2012 11:26:06 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[网页设计]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=1874</guid>
		<description><![CDATA[花了个把小时完整阅读了一遍《HTML5设计原理》，一篇讲HTML5发展历史和设计原理的文章，讲得透彻，做点记录 伯斯塔尔法则（Postel’s Law）设计原理： 发送时要保守；接收时要开放.  发送给浏览器的数据尽量格式严谨；而浏览器接受数据时尽量做到容错，保持开放。 HTML5设计原理 HTML5由W3C HTML5工作组与WHATWG工作组（Web Hypertext Applications Technology Working Group）同心协力共同完成，在合作过程中遵循以下设计原理： 避免不必要的复杂性：简化代码输入和记忆 支持已有的内容：考虑到浏览器厂商实现功能时需要向下兼容 解决现实的问题：如允许将把段落中的文本放在链接里 求真务实 平稳退化：渐进增强 最终用户优先：一旦遇到冲突，最终用户优先，其次是作者，其次是实现者，其次标准制定者，最后才是理论上的完满 参考了一些经典的设计原理 Drupal界面的设计原理： 简化最常见的任务，让不常见的任务不至于太麻烦。 只为80%设计。 给内容创建者最大的权利。 默认设置智能化。 微格式设计原理： 首先为人类设计，其次为机器设计。 Mozilla的设计原理： Internet作为一种公共资源，其运作效率取决于互通性（协议、数据格式、内容）、变革及全球范围内的协作。 基于透明社区的流程有助于增进协作、义务和信任。 Web设计原理： 大多数人的意见和运行的代码。 原文：HTML5设计原理]]></description>
			<content:encoded><![CDATA[<p>花了个把小时完整阅读了一遍《HTML5设计原理》，一篇讲HTML5发展历史和设计原理的文章，讲得透彻，做点记录</p>
<p><strong>伯斯塔尔法则（Postel’s Law）设计原理</strong>：</p>
<blockquote><p>发送时要保守；接收时要开放.</p></blockquote>
<p> 发送给浏览器的数据尽量格式严谨；而浏览器接受数据时尽量做到容错，保持开放。</p>
<p><span id="more-1874"></span></p>
<p><strong>HTML5设计原理</strong></p>
<p>HTML5由W3C HTML5工作组与WHATWG工作组（Web Hypertext Applications Technology Working Group）同心协力共同完成，在合作过程中遵循以下设计原理：</p>
<blockquote>
<ul>
<li>避免不必要的复杂性：简化代码输入和记忆</li>
<li>支持已有的内容：考虑到浏览器厂商实现功能时需要向下兼容</li>
<li>解决现实的问题：如允许将把段落中的文本放在链接里</li>
<li>求真务实</li>
<li>平稳退化：渐进增强</li>
<li>最终用户优先：一旦遇到冲突，最终用户优先，其次是作者，其次是实现者，其次标准制定者，最后才是理论上的完满</li>
</ul>
</blockquote>
<p>参考了一些经典的设计原理</p>
<p><strong>Drupal界面的设计原理：</strong></p>
<blockquote>
<ul>
<li>简化最常见的任务，让不常见的任务不至于太麻烦。</li>
<li>只为80%设计。</li>
<li>给内容创建者最大的权利。</li>
<li>默认设置智能化。</li>
</ul>
</blockquote>
<p><strong>微格式设计原理：</strong></p>
<blockquote><p>首先为人类设计，其次为机器设计。</p></blockquote>
<p><strong>Mozilla的设计原理：</strong></p>
<blockquote><p>Internet作为一种公共资源，其运作效率取决于互通性（协议、数据格式、内容）、变革及全球范围内的协作。<br />
基于透明社区的流程有助于增进协作、义务和信任。</p></blockquote>
<p><strong>Web设计原理：</strong></p>
<blockquote><p>大多数人的意见和运行的代码。</p></blockquote>
<p>原文：<a href="http://www.cn-cuckoo.com/2010/10/21/the-design-of-html5-2151.html" target="_blank">HTML5设计原理</a></p>
]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/html5-design-principles-notes.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【PHP】input的value值出现双引号无法显示的解决办法</title>
		<link>http://witmax.cn/html-input-value-quote.html</link>
		<comments>http://witmax.cn/html-input-value-quote.html#comments</comments>
		<pubDate>Wed, 14 Dec 2011 07:03:57 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[网页设计]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=1842</guid>
		<description><![CDATA[结果浏览器的文本框里只显示了“I&#8217;m a ”，双引号不见了，查看源代码可以发现如下 可见是html解析问题，input value值中的双引号被作为value值的结束符了。 解决办法就是：把双引号替换为&#38;#34;，单引号替换为&#38;#39;。 其他语言类似操作。]]></description>
			<content:encoded><![CDATA[<pre class="brush: php; title: ; notranslate">&lt;?php
$str = &quot;I'm a \&quot;!&quot;;
?&gt;
&lt;input type=&quot;text&quot; value=&quot;&lt;?=$str?&gt;&quot; /&gt;</pre>
<p>结果浏览器的文本框里只显示了“I&#8217;m a ”，双引号不见了，查看源代码可以发现如下</p>
<pre class="brush: xml; title: ; notranslate">&lt;input type=&quot;text&quot; value=&quot;I'm a &quot;!&quot; /&gt;</pre>
<p><span id="more-1842"></span></p>
<p>可见是html解析问题，input value值中的双引号被作为value值的结束符了。</p>
<p>解决办法就是：把双引号替换为&amp;#34;，单引号替换为&amp;#39;。</p>
<pre class="brush: php; title: ; notranslate">&lt;?php
$str = &quot;I'm a \&quot;!&quot;;
$str = str_replace($str, &quot;\&quot;&quot;, &quot;&amp;#34;&quot;);
$str = str_replace($str, &quot;'&quot;, &quot;&amp;#39;&quot;);
?&gt;
&lt;input type=&quot;text&quot; value=&quot;&lt;?=$str?&gt;&quot; /&gt;</pre>
<p>其他语言类似操作。</p>
]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/html-input-value-quote.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>【Javascript】实现字符串的replaceAll方法</title>
		<link>http://witmax.cn/js-replaceall.html</link>
		<comments>http://witmax.cn/js-replaceall.html#comments</comments>
		<pubDate>Thu, 01 Dec 2011 14:58:30 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[网页设计]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=1837</guid>
		<description><![CDATA[Js中string对象只有replace方法，只能替换内容一次，那么就来实现一下replaceAll的方法 具体使用就很简单了]]></description>
			<content:encoded><![CDATA[<div>
<div>Js中string对象只有replace方法，只能替换内容一次，那么就来实现一下replaceAll的方法</div>
<div>
<pre class="brush: jscript; title: ; notranslate">String.prototype.replaceAll  = function(s1,s2){
return this.replace(new RegExp(s1,&quot;gm&quot;),s2);
} </pre>
</div>
</div>
<div>具体使用就很简单了</div>
<div>
<pre class="brush: jscript; title: ; notranslate">var str=&quot;abcabcabc&quot;;
alert(str.replace(&quot;a&quot;, &quot;*&quot;));
alert(str.replaceAll(&quot;a&quot;, &quot;*&quot;));</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/js-replaceall.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【ExtJs】border布局的panel里add内容无效的解决方法</title>
		<link>http://witmax.cn/extjs-border-layout-add-panel.html</link>
		<comments>http://witmax.cn/extjs-border-layout-add-panel.html#comments</comments>
		<pubDate>Sun, 27 Nov 2011 10:19:42 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[网页设计]]></category>
		<category><![CDATA[ExtJs]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=1775</guid>
		<description><![CDATA[如果panel的布局采用了border的布局（也就是东西南北中那种），那么默认是不能使用add方法在border panel里添加子panel的。 这里的解决办法是：在border panel里添加一个固定的方位panel，之后往这个方位panel里添加一个子panel，这样就可以使用add方法了。]]></description>
			<content:encoded><![CDATA[<p>如果panel的布局采用了border的布局（也就是东西南北中那种），那么默认是不能使用add方法在border panel里添加子panel的。</p>
<p>这里的解决办法是：在border panel里添加一个固定的方位panel，之后往这个方位panel里添加一个子panel，这样就可以使用add方法了。</p>
]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/extjs-border-layout-add-panel.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【Javascript】IE和Firefox在DOM解析childNodes时的不同</title>
		<link>http://witmax.cn/js-childnodes.html</link>
		<comments>http://witmax.cn/js-childnodes.html#comments</comments>
		<pubDate>Tue, 25 Oct 2011 15:13:36 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[网页设计]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=1804</guid>
		<description><![CDATA[写js时碰到的一个问题，发现IE8和Firefox在处理childNodes时结果不同：Firefox和IE9会将回车解析生成TextNode类型的DOM节点，而IE8不会。 可以通过以下代码进行验证 &#60;!doctype html&#62; &#60;html&#62; &#60;head&#62;测试childNodes&#60;/head&#62; &#60;body&#62; &#60;div id=&#34;main&#34;&#62; &#60;div id=&#34;div1&#34;&#62;1&#60;/div&#62; &#60;div id=&#34;div2&#34;&#62;2&#60;/div&#62; &#60;/div&#62; &#60;script&#62; var a=document.getElementById(&#34;main&#34;).childNodes; alert(a.length); &#60;/script&#62; &#60;/body&#62;&#60;/html&#62; 提示：你可以先修改部分代码再运行。 用Firebug在Firefox可以看到如下结果，发现childNodes有5个元素，其中的3个都是TextNode，也就是div前后的回车符解析出来的。 在IE9上测试，用开发人员工具查看了一下childNodes结果，发现结果与Firefox表现一致， childNodes有5个元素，其中的3个都是TextNode。如下图： 但在IE8下，用开发人员工具查看了一下childNodes结果，发现childNodes有2个元素，即2个div元素，不包括TextNode。如下图： 至于如何处理这两种差异，只需要在Firefox中判断节点的NodeType即可，所有NodeType值如下： 值 描述 1 Element Node 单元节点 2 Attribute Node 属性节点 3 Text Node 文本节点 4 CDATA Section Node CDATA选择节点 5 Entity Reference Node 实体索引节点 6 Entity Node 实体节点 7 Processing [...]]]></description>
			<content:encoded><![CDATA[<p>写js时碰到的一个问题，发现IE8和Firefox在处理childNodes时结果不同：<strong>Firefox和IE9会将回车解析生成TextNode类型的DOM节点，而IE8不会。</strong></p>
<p>可以通过以下代码进行验证</p>
<div class="runcode">
<p><textarea name="runcode" style="overflow-y:visible;width:540px;font-size:12px" class="runcode_text" id="runcode_6FelAA">&lt;!doctype html&gt;
&lt;html&gt;
&lt;head&gt;测试childNodes&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;main&quot;&gt;
   &lt;div id=&quot;div1&quot;&gt;1&lt;/div&gt;
   &lt;div id=&quot;div2&quot;&gt;2&lt;/div&gt;
&lt;/div&gt;
&lt;script&gt;
 var a=document.getElementById(&quot;main&quot;).childNodes;
 alert(a.length);
&lt;/script&gt;
&lt;/body&gt;&lt;/html&gt;</textarea></p>
<script type="text/javascript">function changeTsize(){document.getElementById("runcode_6FelAA").style.height = document.getElementById("runcode_6FelAA").scrollHeight + "px";}window.setTimeout(changeTsize,0);</script><p><input type="button" value="运行" class="runcode_button" onclick="runcode_open_new('runcode_6FelAA');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_6FelAA');"/> <input type="button" value="另存代码" class="runcode_button" onclick="saveCode('runcode_6FelAA','runcode_6FelAA');"/> 提示：你可以先修改部分代码再运行。</p>
</div>
<p><span id="more-1804"></span></p>
<p>用Firebug在Firefox可以看到如下结果，发现childNodes有5个元素，其中的3个都是TextNode，也就是div前后的回车符解析出来的。</p>
<p><div class="wp-caption aligncenter" style="width: 390px"><a title="Firefox下childNodes的表现" href="http://witmax.cn/img/js-childnodes-ff.png" rel="lightbox[childnodes]"><img title="Firefox下childNodes的表现" src="http://witmax.cn/img/js-childnodes-ff.png" alt="Firefox下childNodes的表现" width="380" /></a><p class="wp-caption-text">Firefox下childNodes的表现</p></div>在IE9上测试，用开发人员工具查看了一下childNodes结果，发现结果与Firefox表现一致， childNodes有5个元素，其中的3个都是TextNode。如下图：</p>
<p><div class="wp-caption aligncenter" style="width: 359px"><a title="IE9下childNodes的表现" href="http://witmax.cn/img/js-childnodes-ie9.png" rel="lightbox[childnodes]"><img title="IE9下childNodes的表现" src="http://witmax.cn/img/js-childnodes-ie9.png" alt="IE9下childNodes的表现" width="349" /></a><p class="wp-caption-text">IE9下childNodes的表现</p></div>但在IE8下，用开发人员工具查看了一下childNodes结果，发现childNodes有2个元素，即2个div元素，不包括TextNode。如下图：</p>
<p><div class="wp-caption aligncenter" style="width: 263px"><a title="IE8下childNodes的表现" href="http://witmax.cn/img/js-childnodes-ie8.png" rel="lightbox[childnodes]"><img title="IE8下childNodes的表现" src="http://witmax.cn/img/js-childnodes-ie8.png" alt="IE8下childNodes的表现" width="253" /></a><p class="wp-caption-text">IE8下childNodes的表现</p></div>至于如何处理这两种差异，只需要在Firefox中判断节点的NodeType即可，所有NodeType值如下：</p>
<table>
<tbody>
<tr>
<th>值</th>
<th>描述</th>
</tr>
<tr>
<td>1</td>
<td>Element <span>Node</span> 单元节点</td>
</tr>
<tr>
<td>2</td>
<td>Attribute <span>Node</span> 属性节点</td>
</tr>
<tr>
<td>3</td>
<td>Text <span>Node</span> 文本节点</td>
</tr>
<tr>
<td>4</td>
<td>CDATA Section <span>Node</span> CDATA选择节点</td>
</tr>
<tr>
<td>5</td>
<td>Entity Reference <span>Node</span> 实体索引节点</td>
</tr>
<tr>
<td>6</td>
<td>Entity <span>Node</span> 实体节点</td>
</tr>
<tr>
<td>7</td>
<td>Processing Instruction <span>Node</span> 进程中的指示节点</td>
</tr>
<tr>
<td>8</td>
<td>Comment <span>Node</span> 注释节点</td>
</tr>
<tr>
<td>9</td>
<td>Document <span>Node</span> 文档节点</td>
</tr>
<tr>
<td>10</td>
<td>Document Type <span>Node</span> 文档类型节点</td>
</tr>
<tr>
<td>11</td>
<td>Document Fragment <span>Node</span> 文档碎片节点</td>
</tr>
<tr>
<td>12</td>
<td>Notation <span>Node</span> 符号节点</td>
</tr>
</tbody>
</table>
<p>参考代码：</p>
<div class="runcode">
<p><textarea name="runcode" style="overflow-y:visible;width:540px;font-size:12px" class="runcode_text" id="runcode_YHJqAR">&lt;!doctype html&gt;
&lt;html&gt;
&lt;head&gt;测试childNodes&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;main&quot;&gt;
   &lt;div id=&quot;div1&quot;&gt;1&lt;/div&gt;
   &lt;div id=&quot;div2&quot;&gt;2&lt;/div&gt;
&lt;/div&gt;
&lt;script&gt;
 var nodes=document.getElementById(&quot;main&quot;).childNodes;
 var len = nodes.length;
 var n = 0;
 for(var i=0; i&lt;len; i++){
  if (nodes[i].nodeType == 1){
   n++;
  }
 }
 alert(len);
 alert(n);
&lt;/script&gt;
&lt;/body&gt;&lt;/html&gt;</textarea></p>
<script type="text/javascript">function changeTsize(){document.getElementById("runcode_YHJqAR").style.height = document.getElementById("runcode_YHJqAR").scrollHeight + "px";}window.setTimeout(changeTsize,0);</script><p><input type="button" value="运行" class="runcode_button" onclick="runcode_open_new('runcode_YHJqAR');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_YHJqAR');"/> <input type="button" value="另存代码" class="runcode_button" onclick="saveCode('runcode_YHJqAR','runcode_YHJqAR');"/> 提示：你可以先修改部分代码再运行。</p>
</div>
<p>参考：<a href="https://developer.mozilla.org/cn/%E4%BB%8EInternet_Explorer%E8%BF%81%E7%A7%BB%E5%88%B0Mozilla" target="_blank">从Internet Explorer迁移到Mozilla</a></p>
]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/js-childnodes.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>【Javascript】IE下substr()函数截取末尾字符时的问题</title>
		<link>http://witmax.cn/js-ie-substr.html</link>
		<comments>http://witmax.cn/js-ie-substr.html#comments</comments>
		<pubDate>Sat, 03 Sep 2011 12:14:58 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[网页设计]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=1764</guid>
		<description><![CDATA[这两天刚遇到一个问题，substr()函数在IE和FF下表现不一致，导致了一个IE下的bug。 可以通过以下代码来测试： &#60;script&#62;var str = &#34;abc&#34;; alert(str.substr(-1, 1));&#60;/script&#62; 提示：你可以先修改部分代码再运行。 希望得到的是c，FF下表现正常；但跑到IE下，显示abc，不是期望的结果。看来IE在处理substr()第一个参数为负数的情况处理方式不一样。 为了解决问题，另觅蹊径，改用substring()函数代替substr() &#60;script&#62;var str = &#34;abc&#34;; var len = str.length; alert(str.substring(len - 1, len));&#60;/script&#62; 提示：你可以先修改部分代码再运行。 p.s. 附一篇学习文章：substr() vs substring() vs slice() substr() substr() method extracts a specified number of characters in a string, from a start index. Syntax: string.substr(start, length); Quick Notes aout Substr: If start is [...]]]></description>
			<content:encoded><![CDATA[<p>这两天刚遇到一个问题，substr()函数在IE和FF下表现不一致，导致了一个IE下的bug。</p>
<p>可以通过以下代码来测试：</p>
<div class="runcode">
<p><textarea name="runcode" style="overflow-y:visible;width:540px;font-size:12px" class="runcode_text" id="runcode_E3thXD">&lt;script&gt;var str = &quot;abc&quot;;
alert(str.substr(-1, 1));&lt;/script&gt;</textarea></p>
<script type="text/javascript">function changeTsize(){document.getElementById("runcode_E3thXD").style.height = document.getElementById("runcode_E3thXD").scrollHeight + "px";}window.setTimeout(changeTsize,0);</script><p><input type="button" value="运行" class="runcode_button" onclick="runcode_open_new('runcode_E3thXD');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_E3thXD');"/> <input type="button" value="另存代码" class="runcode_button" onclick="saveCode('runcode_E3thXD','runcode_E3thXD');"/> 提示：你可以先修改部分代码再运行。</p>
</div>
<p>希望得到的是c，FF下表现正常；但跑到IE下，显示abc，不是期望的结果。看来IE在处理substr()第一个参数为负数的情况处理方式不一样。</p>
<p>为了解决问题，另觅蹊径，改用substring()函数代替substr()<span id="more-1764"></span></p>
<div class="runcode">
<p><textarea name="runcode" style="overflow-y:visible;width:540px;font-size:12px" class="runcode_text" id="runcode_o2hDnS">&lt;script&gt;var str = &quot;abc&quot;;
var len = str.length;
alert(str.substring(len - 1, len));&lt;/script&gt;</textarea></p>
<script type="text/javascript">function changeTsize(){document.getElementById("runcode_o2hDnS").style.height = document.getElementById("runcode_o2hDnS").scrollHeight + "px";}window.setTimeout(changeTsize,0);</script><p><input type="button" value="运行" class="runcode_button" onclick="runcode_open_new('runcode_o2hDnS');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_o2hDnS');"/> <input type="button" value="另存代码" class="runcode_button" onclick="saveCode('runcode_o2hDnS','runcode_o2hDnS');"/> 提示：你可以先修改部分代码再运行。</p>
</div>
<p>p.s. 附一篇学习文章：substr() vs substring() vs slice()</p>
<p><strong>substr()</strong></p>
<p>substr() method extracts a specified number of characters in a string, from a start index.</p>
<blockquote><p><strong>Syntax:</strong> string.substr(start, length);</p></blockquote>
<p>Quick Notes aout Substr:</p>
<ul>
<li>If start is negative, <strong>Internet Explorer</strong> returns the whole string. That’s wrong! IE should use the last character in the string.</li>
</ul>
<p><strong>substring()</strong></p>
<p>substring() method extracts the chars in a string between two specified indexes.</p>
<blockquote><p><strong>Syntax:</strong> string.substring(start, stop);</p></blockquote>
<p>Quick Notes about Substring:</p>
<ul>
<li>If start equals stop<code>, </code>it returns an empty string.</li>
<li>If stop is omitted, it extracts characters to the end of the string.</li>
<li>If either argument is less than 0 or is NaN, it is treated as if it were 0.</li>
<li>If either argument is greater than string’s length, either argument will use string’s length.</li>
<li>If start &gt; stop, then substring will swap those 2 arguments</li>
</ul>
<p><strong>slice()</strong></p>
<p>slice() works like substring() with a few different behaviors.</p>
<blockquote><p><strong>Syntax:</strong> string.slice(start, stop);</p></blockquote>
<p>Quick Notes about Slice:</p>
<ul>
<li>If stop is omitted, slice extracted chars to the end of the string, exactly like substring().</li>
<li>If start &gt; stop, slice() will NOT swap the 2 arguments.</li>
<li>If start is negative, slice() will set char from the end of string, exactly like substr() in Firefox. This behavior is observed in both Firefox and IE.</li>
<li>If stop is negative, slice() will set stop to: <em>(string.length – 1) – stop (original value).</em></li>
</ul>
<p>参考：<a href="http://rapd.wordpress.com/2007/07/12/javascript-substr-vs-substring/" target="_blank">Javascript: substr() v.s. substring()</a></p>
]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/js-ie-substr.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【ExtJs】Ext.form.DateField在chrome、safari下显示异常的解决方法</title>
		<link>http://witmax.cn/extjs-datefield-safari.html</link>
		<comments>http://witmax.cn/extjs-datefield-safari.html#comments</comments>
		<pubDate>Sat, 27 Aug 2011 03:21:22 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[网页设计]]></category>
		<category><![CDATA[ExtJs]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=1746</guid>
		<description><![CDATA[Ext.form.DateField在chrome、safari下显示异常，日期选择组件会显得的很长，盛满屏幕。 解决方法是打个补丁，如下： 参考：http://www.fafrei.com/2010/12/ext-form-datefield-firefox%E6%98%BE%E7%A4%BA%E5%BC%82%E5%B8%B8/]]></description>
			<content:encoded><![CDATA[<p>Ext.form.DateField在chrome、safari下显示异常，日期选择组件会显得的很长，盛满屏幕。</p>
<p>解决方法是打个补丁，如下：</p>
<pre class="brush: jscript; title: ; notranslate">Ext.override(Ext.menu.DateMenu,{
 render : function(){
  Ext.menu.DateMenu.superclass.render.call(this);
  if(Ext.isGecko|| Ext.isSafari){
   this.picker.el.dom.childNodes[0].style.width = '178px';
   this.picker.el.dom.style.width = '178px';
  }
 }
});</pre>
<p>参考：http://www.fafrei.com/2010/12/ext-form-datefield-firefox%E6%98%BE%E7%A4%BA%E5%BC%82%E5%B8%B8/</p>
]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/extjs-datefield-safari.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【ExtJs】GridPanel表头错位和自适应宽度的解决方法</title>
		<link>http://witmax.cn/extjs-gridpanel-header-malposition.html</link>
		<comments>http://witmax.cn/extjs-gridpanel-header-malposition.html#comments</comments>
		<pubDate>Thu, 25 Aug 2011 17:24:27 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[网页设计]]></category>
		<category><![CDATA[ExtJs]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=1742</guid>
		<description><![CDATA[1、ExtJS 2.2中，Ext.grid.GridPanel在IE中表头的图标会发生错位，如图所示： 但是在Firefox中显示是正常的。 解决方法为：在所用到的css文件中添加代码， 2、Ext.grid.GridPanel在IE中的宽度太大，而且不能自适应宽度，解决方法见如下的一段代码： 关键是设置bodyStyle的值为width:100% 原文：http://wangju19870301.iteye.com/blog/556129]]></description>
			<content:encoded><![CDATA[<p>1、ExtJS 2.2中，Ext.grid.GridPanel在IE中表头的图标会发生错位，如图所示：</p>
<div class="wp-caption aligncenter" style="width: 322px"><a href="http://witmax.cn/img/extjs-gridpanel-header-malposition.jpg" rel="lightbox[extjs]" title="GridPanel表头错位"><img title="GridPanel表头错位" src="http://witmax.cn/img/extjs-gridpanel-header-malposition.jpg" alt="" width="312" height="207" /></a><p class="wp-caption-text">GridPanel表头错位</p></div>
<p>但是在Firefox中显示是正常的。</p>
<p>解决方法为：在所用到的css文件中添加代码，</p>
<pre class="brush: css; title: ; notranslate">.ext-ie6 .x-menu-item-icon,.ext-ie7 .x-menu-item-icon,.ext-ie8 .x-menu-item-icon {
   left: -24px;
}</pre>
<p><span id="more-1742"></span></p>
<p>2、Ext.grid.GridPanel在IE中的宽度太大，而且不能自适应宽度，解决方法见如下的一段代码：</p>
<pre class="brush: jscript; highlight: [5]; title: ; notranslate">var grid = new Ext.grid.GridPanel({
   renderTo : &quot;content&quot;,
   autoHeight : true,
   frame : true,
   bodyStyle : &quot;width:100%&quot;,
   viewConfig : {
      forceFit : true
   }
});</pre>
<p>关键是设置bodyStyle的值为width:100%</p>
<p>原文：<a href="http://wangju19870301.iteye.com/blog/556129">http://wangju19870301.iteye.com/blog/556129</a></p>
]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/extjs-gridpanel-header-malposition.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

