<html>
<head>
<script>
var lists=getByClass('meun');
alert(lists.length);
function getByClass(className){
var nodes=document.getElementsByTagName('*');
ret=[];
for(var i;i<nodes.length;i++){
if(hasClassName(nodes[i],className)) ret.push(nodes[i]);}return ret;
}
function hasName(node,className){
var names=node.className.split(/\s+/);
for(var i=0;i<names.length;i++){
if(names[i]==className)return true;
}
}
</script>
</head>
<body>
<div class="meun"></div>
</body>
</html>
那里错了
森林海
白猪掌柜的
相关分类