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>

 

posted @ 2020-06-14 15:46  嘆世殘者——華帥  阅读(158)  评论(0编辑  收藏  举报