您還可以參考以下HTML5相關教程及資源:
作者已經把js檔案放在Google code project上并允許大家直接調用,當然,前提是你不在意調用額外的檔案。
<a href="http://html5shiv.googlecode.com/svn/trunk/html5.js" target="_blank">http://html5shiv.googlecode.com/svn/trunk/html5.js</a>
你可以使用IE條件注釋來調用這個js檔案,這樣像FireFox等非IE浏覽器就會忽視這段代碼,也就不會有無謂的http請求了。下面這段代碼僅會在IE浏覽器下運作:
1
2
3
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
當然如果你不喜歡調用外網檔案,你也可以下載下傳下來上傳到自己的伺服器單獨調用(作者允許)。
以下是js檔案中的代碼:
(function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,canvas,datalist,details,dialog,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video".split(','),i=e.length;while(i--){document.createElement(e[i])}})()