HTML5標籤 兼容低版本IE瀏覽器

利用document.createElement創建當前瀏覽器(IE6-8)不支持的標籤名

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style type="text/css">
            article {
                color: #008FD8;
                font-size: 36px;
            }
        </style>
        <script type="text/javascript">
            (function() {
                if (!
                /*@cc_on!@*/
                0) return;
                var e = "abbr, article, aside, audio, canvas, datalist, details, dialog, eventsource, figure, footer, header, hgroup, mark, meter, nav, output, progress, section, time, video".split(", ");
                var i = e.length;
                while (i--) {
                    document.createElement(e[i]);
                }
            })();
        </script>
    </head>
    <body>
        <article>Harold</article>
    </body>
</html>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章