Sjoerd Visscher 發現了一個簡潔的方法樣式在 IE 中作用到未知的元素上 —— 僅需 JS 創建此未知元素即可:
同理(對於 IE 來說 HTML5 元素即是未知元素),該方法也可順延到 HTML5 的元素上(詳細見:John Resig 寫的 《HTML5 Shiv》 一文):
在 IE 中,為了更方便使用 HTML5 元素,我們可以引入這樣的腳本:
詳細具體應用的案例如下:
《Moving markup towards HTML5》
《Test new HTML 5 elements》
![]()
![]()
document.createElement(elementName)
同理(對於 IE 來說 HTML5 元素即是未知元素),該方法也可順延到 HTML5 的元素上(詳細見:John Resig 寫的 《HTML5 Shiv》 一文):
![]()
![]()
<html>
<head>
<style>section { color: red; }</style>
<script>document.createElement("section")</script>
</head>
<body>
<section>Hello World!</section>
</body>
</html>
在 IE 中,為了更方便使用 HTML5 元素,我們可以引入這樣的腳本:
![]()
![]()
(function(){
// from: http://dean.edwards.name/weblog/2007/03/sniff/
if(!/*@cc_on!@*/0) return;
var html5 = "abbr,article,aside,audio,bb,canvas,datagrid,datalist,details,dialog,eventsource,figure,footer,hgroup,header,mark,menu,meter,nav,output,progress,section,time,video".split(',');
for(var i = 0, len = html5.length; i < len; i++ )
document.createElement(html5[i]);
}
})();
詳細具體應用的案例如下:
《Moving markup towards HTML5》
《Test new HTML 5 elements》

