function byClass(classname){ if(document.getElementsByClassName){ //if it is Firefox return document.getElementsByClassName(classname); }else{ tags=document.getElementsByTagName("*"); tagslength=tags.length; gettags=[]; for(var i=0;i<tagslength;i++){ if(tags[i].className==classname){ gettags.push(tags[i]); } } return gettags; } }
时间: 2024-10-25 03:55:26