sto cercando di scorrere tutti gli elementi retruned da getElementsByTagName("input")
utilizzando foreach. Qualche idea sul perché questo non funziona in FF, Chrome o IE?JavaScript: ciclo tra tutti gli elementi restituiti da getElementsByTagName
<html>
<head>
</head>
<body>
<input type="text" value="" />
<input type="text" value="" />
<script>
function ShowResults(value, index, ar) {
alert(index);
}
var input = document.getElementsByTagName("input");
alert(input.length);
input.forEach(ShowResults);
</script>
</body>
</html>
Razionale perché nessuno 'forEach': http://stackoverflow.com/questions/13433799/why-doesnt-nodelist-have-foreach –