<div class='group'></div>
<div class='group'></div>
<div class='group'></div>
<div class='group'></div>
<div class='group'></div>
<div class='group'></div>
<script type='text/javascript'>
function Group(groupname, handler) {
var R = [];
for (var I = 0, E = document.getElementsByTagName("*"), L = E.length; I < L; I++) {
if (new RegExp("\\b" + groupname + "\\b").test(E[I].className)) {
handler && handler.call(E[I]);
if (!handler)
R.push(E[I]);
}
}
return R;
}
Group("group", function (index) {
this.innerHTML = "DIV";
this.style.color = "red";
});
Group("group")[3].innerHTML = "MWAAAX";
</script>