标签: html5

  • 通过JS在IE中使用HTML5元素

    通过JS 创建此对于IE未知的HTML5元素,再在CSS定义样式属性:

    document.createElement(newElementName)

    具体实现:

    <html>
    <head>
    <style>blah { color: red; }</style>

    <script>document.createElement("blah")</script>
    </head>
    <body>
    <blah>Hello!</blah>
    </body>
    </html>

    更多详细请参考:《HTML5 Shiv》

    批量引入新元素[怿飞]

    (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]);
        }
    })();

    很简单,很省事~