<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="ARTICLE @ XOOPS powered by FeedCreator" -->
<rss version="0.91">
    <channel>
        <title>睡蓮‧池水間 :: 文章</title>
        <description><![CDATA[文章XML]]></description>
        <link>http://waterlily-lsl.com/modules/article/view.article.php/187/c2</link>
        <lastBuildDate>Thu, 24 May 2012 01:24:08 +0200</lastBuildDate>
        <generator>ARTICLE @ XOOPS powered by FeedCreator</generator>
        <image>
            <url>http://waterlily-lsl.com/modules/article/images/logo.png</url>
            <title>睡蓮‧池水間 :: 文章</title>
            <link>http://waterlily-lsl.com/modules/article/</link>
            <width>92</width>
            <height>52</height>
            <description>文章XML</description>
        </image>
        <language>zh-TW</language>
        <managingEditor>waterlily at waterlily-lsl dot com</managingEditor>
        <webMaster>waterlily at waterlily-lsl dot com</webMaster>
        <category>文章</category>
        <item>
            <title>如何在 IE 中使用 HTML 5 元素</title>
            <link>http://waterlily-lsl.com/modules/article/view.article.php/187/c2</link>
            <description><![CDATA[類別: 語言集<br />來源: (http://www.planabc.net/2009/06/13/how_to_use_html5_elements_in_ie/)Sjoerd Visscher 發現了一個簡潔的方法樣式在 IE 中作用到未知的元素上 —— 僅需 JS 創建此未知元素即可：<br /><div class="xoopsCode"><p class="cTitle"><img class="icon-l" src="http://waterlily-lsl.com/themes/waterlilyLSL-GW/img/code-icon1.gif" alt=""/><img class="icon-r" src="http://waterlily-lsl.com/themes/waterlilyLSL-GW/img/code-icon2.gif" alt=""/></p><pre>
document.createElement(elementName)
</pre></div><br />同理（對於 IE 來說 HTML5 元素即是未知元素），該方法也可順延到 HTML5 的元素上（詳細見：<a href="http://ejohn.org/" rel="external">John Resig</a> 寫的 《<a href="http://ejohn.org/blog/html5-shiv/" rel="external">HTML5 Shiv</a>》 一文）：<br /><div class="xoopsCode"><p class="cTitle"><img class="icon-l" src="http://waterlily-lsl.com/themes/waterlilyLSL-GW/img/code-icon1.gif" alt=""/><img class="icon-r" src="http://waterlily-lsl.com/themes/waterlilyLSL-GW/img/code-icon2.gif" alt=""/></p><pre>
&lt;html&gt;
&lt;head&gt;
&lt;style&gt;section { color: red; }&lt;/style&gt;
&lt;script&gt;document.createElement(&quot;section&quot;)&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;section&gt;Hello World!&lt;/section&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre></div><br />在 IE 中，為了更方便使用 HTML5 元素，我們可以引入這樣的腳本：<br /><div class="xoopsCode"><p class="cTitle"><img class="icon-l" src="http://waterlily-lsl.com/themes/waterlilyLSL-GW/img/code-icon1.gif" alt=""/><img class="icon-r" src="http://waterlily-lsl.com/themes/waterlilyLSL-GW/img/code-icon2.gif" alt=""/></p><pre>
(function(){
    // from: <a href="http://dean.edwards.name/weblog/2007/03/sniff/" title="http://dean.edwards.name/weblog/2007/03/sniff/" rel="external">http://dean.edwards.name/weblog/2007/03/sniff/</a>
    if(!/*@cc_on!@*/0) return; 

    var html5 = &quot;abbr,article,aside,audio,bb,canvas,datagrid,datalist,details,dialog,eventsource,figure,footer,hgroup,header,mark,menu,meter,nav,output,progress,section,time,video&quot;.split(&#039;,&#039;);
    for(var i = 0, len = html5.length; i &lt; len; i++ )
        document.createElement(html5[i]);
    }
})();
</pre></div><br />詳細具體應用的案例如下：<br />　　《<a href="http://www.fofronline.com/2009-06/moving-markup-towards-html5/" rel="external">Moving markup towards HTML5</a>》<br />　　《<a href="http://www.brucelawson.co.uk/tests/html5-elements.html" rel="external">Test new HTML 5 elements</a>》<br />]]></description>
            <author>睡蓮</author>
            <pubDate>Sat, 20 Jun 2009 22:27:33 +0200</pubDate>
        </item>
    </channel>
</rss>

