标签:javascrip 兼容性 spl break new || 函数参数默认值 length cti
1、ie8不支持getElementsByClassName()方法
【解决办法】
if(!document.getElementsByClassName){ document.getElementsByClassName = function(className, element){ var children = (element || document).getElementsByTagName(‘*‘); var elements = new Array(); for (var i=0; i<children.length; i++){ var child = children[i]; var classNames = child.className.split(‘ ‘); for (var j=0; j<classNames.length; j++){ if (classNames[j] == className){ elements.push(child); break; } } } return elements; }; }
2、ie8给函数参数默认值报错
标签:javascrip 兼容性 spl break new || 函数参数默认值 length cti
原文地址:https://www.cnblogs.com/liwuming/p/10112024.html