• getElementsByClassName兼容低版本浏览器


    var getElementsByClassName = function (searchClass, node,tag) {
         if(document.getElementsByClassName){
             var nodes = (node || document).getElementsByClassName(searchClass),result = [];
             for(var i=0 ;node = nodes[i++];){
                if(tag !== "*" && node.tagName === tag.toUpperCase()){
                     result.push(node)
                 }else{
                     result.push(node)
                 }
             }
         return result
         }else{
             node = node || document;
             tag = tag || "*";
             var classes = searchClass.split(" "),
             elements = (tag === "*" && node.all)? node.all : node.getElementsByTagName(tag),
             patterns = [],
             current,
             match;
             var i = classes.length;
             while(--i >= 0){
                 patterns.push(new RegExp("(^|s)" + classes[i] + "(s|$)"));
             }
             var j = elements.length;
             while(--j >= 0){
                 current = elements[j];
                match = false;
                for(var k=0, kl=patterns.length; k<kl; k++){
                    match = patterns[k].test(current.className);
                    if (!match) break;
                    }    
                    if (match) result.push(current);
                }
             return result;
             }
         }
  • 相关阅读:
    MyBatis 配置文件 用户密码加密存储
    MyBatis 实例
    mybatis 入门搭建
    文件上传
    struts 结果类型
    Struts 拦截器
    log4j
    Struts Action 控制器
    Struts
    四、常用的Maven命令
  • 原文地址:https://www.cnblogs.com/MY0101/p/6382475.html
Copyright © 2020-2023  润新知