网站前端开发吧 关注:41贴子:211
  • 1回复贴,共1

如何在IE8及之前的浏览器使用HTML5的标签

只看楼主收藏回复

现在HTML越来越火了,可好多浏览器上还不能够使用HTML5标签,如:article,aside,details,figcaption,figure,footer,header,hgroup,nav,section
这些标签在IE6,IE7,IE8浏览器上不起作用。这个问题应该怎么解决?
当然是有办法解决的。
function createHtml5Mark(){
// arguments 序列化,成为真下的数组
var args = Array.prototype.slice.call(arguments,0);
argLen = args.length,
doc = document;
// 循环数据创建元素
for(var i=0;i<argLen;i++){
doc.createElement(args[i]);
}
}
createHtml5Mark('article','aside','details','figcaption','figure','footer','header','hgroup','nav','section');
OK 这样就可以在IE6,IE7,IE8浏览器使用HTML标签了
可以大胆的在不支持HTML5标签的浏览器上写HTML5的标签了I


IP属地:北京1楼2013-11-01 13:44回复
    真的不错


    IP属地:北京2楼2013-11-01 14:16
    回复