A mi esto me funciona correctamente:
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>test</title>
<script>
function algo(){
var coleccion = document.getElementsByTagName('div');
for (var i = 0, j = coleccion.length; i < j; i++) {
coleccion[i].onmouseover = function(){alert(this.id+'--'+i)};
}
}
</script>
</head>
<body onload="algo()">
<div id="a" style="border:thin solid #000;margin:3px;">aaa</div>
<div id="b" style="border:thin solid #000;margin:3px;">bbb</div>
<div id="c" style="border:thin solid #000;margin:3px;">ccc</div>
</body>
</html>