ArMikael,
не?
<html>
<body>
<table>
<tr>
<td>Newton</td>
<td>75</td>
</tr>
<tr>
<td>Darwin</td>
<td>94</td>
</tr>
<tfoot>
<tr>
<td>Average</td>
<td>?</td>
</tr>
</tfoot>
</table>
<script type="text/javascript">
function calcAverage(){
var grades = document.getElementsByTagName("td");
var average = Number;
var sum = 0;
var divider =0;
var grade;
for (i=0; i < grades.length; i++){
//if(typeof(grades[i].innerHTML) == Number) {
if ((i%2) && (grades[i].innerHTML !== "?")) {
grade = Number(grades[i].innerHTML);
sum = sum + grade;
divider++;
}
else if (grades[i].innerHTML=="?") {
var average = Number(sum/divider);
var tfoot = document.getElementsByTagName("tfoot")[0];
tfoot.getElementsByTagName("tr")[0].children[1].innerHTML = average;
}
}
}
calcAverage();
</script>
</body>
</html>