标签:des style blog color io for cti div
function getByClass( className, context) { var context = context || document; if( context.getElementsByClassName) { return context.getElementsByClassName(className); } var nodes = context.getElementsByTagName("*"); ret=[]; for( var i=0; i<nodes.length; i++) { if( hasClass(nodes[i],className)) { ret.push(nodes[i]); } } return ret; } function hasClass ( node, className) { var names = node.className.split(/\s+/); for ( var i=0;i<names.length;i++) { if(names[i]==className) { return true; } } return false; }
原生js获取css中class的方法,布布扣,bubuko.com
标签:des style blog color io for cti div
原文地址:http://www.cnblogs.com/violinxliu/p/3870089.html