ie7|ie7,IE8不支持document.getElmentsByClassName的问题

1 if (!document.getElementsByClassName) { 2document.getElementsByClassName = function(className, element) { 3var children = (element || document).getElementsByTagName('*'); 4var elements = new Array(); 5for (var i = 0; i < children.length; i++) { 6var child = children[i]; 7var classNames = child.className.split(' '); 8for (var j = 0; j < classNames.length; j++) { 9if (classNames[j] == className) { 10elements.push(child); 11break; 12} 13} 14} 15return elements; 16}; 17 }

【ie7|ie7,IE8不支持document.getElmentsByClassName的问题】解决ie7,IE8不支持document.getElmentsByClassName的问题
转载于:https://www.cnblogs.com/lmaster/p/6273125.html

    推荐阅读