function $byclass(classname,pName){ var node = null, temps = [], re = new RegExp('\\b'+classname+'\\b','i'); if(typeof pName != 'undefined'){ node = pName; }else{ node = document; } var all = node.getElementsByTagName("*"); for(var i=0;i<all.length;i++){ if(re.test(all[i].className)){ temps.push(all[i]); } } if(temps.length == 1){ return temps[0]; } return temps; }
通过class获取元素:$byclass
上次更新时间 : 2013-05-12 11:44
暂无评论