-3
Good afternoon.. Ta all working just so that I am not able to put the value of approved student accountants or not. anyone help me please.. I want to add the values there at the end of the html in the part:
td Failed Students /td
td HERE HAD TO COME OUT THE VALUE OF THE FAILED COUNTER /td>
var aprovados = 0, reprovados = 0;
function calcula_media(i)
{
var n1 = document.getElementById("n1_aluno_" + i).value;
var n2 = document.getElementById("n2_aluno_" + i).value;
var media = document.getElementById("media_aluno_" + i);
var resultado = document.getElementById("resultado_aluno_" + i);
var calculo = (parseFloat(n1) + parseFloat(n2)) / 2;
if(calculo >= 70)
{
media.innerHTML = "<div class='text-success'>" + calculo + "</div>";
resultado.innerHTML = "Aprovado";
aprovados++;
}
else if(calculo >=30)
{
media.innerHTML = "<div class='text-rec'>" + calculo + "</div>";
resultado.innerHTML = "Recuperaçao";
}
else
{
media.innerHTML = "<div class='text-danger'>" + calculo + "</div>";
resultado.innerHTML = "Reprovado";
reprovados++;
}
}
<div class="container">
<h2>Notas Alunos</h2>
<p>Digite as notas dos alunos e saiba se ele esta Aprovado, Recuperação ou Reprovado</p>
<table class="table notas">
<thead>
<tr>
<th>Estudante</th>
<th>N1</th>
<th>N2</th>
<th>Média</th>
<th>Resultado Final</th>
</tr>
</thead>
<tbody>
<tr>
<td>Stella</td>
<td><input id="n1_aluno_0" type="number" value="0" min="0.0" step="0.1" max="10.0" onchange="calcula_media(0)"></td>
<td><input id="n2_aluno_0" type="number" value="0" min="0.0" step="0.1" max="10.0" onchange="calcula_media(0)"></td>
<td><div id="media_aluno_0"> </div></td>
<td><div id="resultado_aluno_0">-- </div></td>
</tr>
<tr>
<td>Petronio</td>
<td><input id="n1_aluno_1" type="number" value="0" min="0.0" step="0.1" max="10.0" onchange="calcula_media(1)"></td>
<td><input id="n2_aluno_1" type="number" value="0" min="0.0" step="0.1" max="10.0" onchange="calcula_media(1)"></td>
<td><div id="media_aluno_1"> </div></td>
<td><div id="resultado_aluno_1">-- </div></td>
</tr>
<tr>
<td>Waldeir</td>
<td><input id="n1_aluno_2" type="number" value="0" min="0.0" step="0.1" max="10.0" onchange="calcula_media(2)"></td>
<td><input id="n2_aluno_2" type="number" value="0" min="0.0" step="0.1" max="10.0" onchange="calcula_media(2)"></td>
<td><div id="media_aluno_2"> </div></td>
<td><div id="resultado_aluno_2">-- </div></td>
</tr>
<tr>
<td>Arthur</td>
<td><input id="n1_aluno_3" type="number" value="0" min="0.0" step="0.1" max="10.0" onchange="calcula_media(3)"></td>
<td><input id="n2_aluno_3" type="number" value="0" min="0.0" step="0.1" max="10.0" onchange="calcula_media(3)"></td>
<td><div id="media_aluno_3"> </div></td>
<td><div id="resultado_aluno_3">-- </div></td>
</tr>
<tr>
<td>Jean</td>
<td><input id="n1_aluno_4" type="number" value="0" min="0.0" step="0.1" max="10.0" onchange="calcula_media(4)"></td>
<td><input id="n2_aluno_4" type="number" value="0" min="0.0" step="0.1" max="10.0" onchange="calcula_media(4)"></td>
<td><div id="media_aluno_4"> </div></td>
<td><div id="resultado_aluno_4">-- </div></td>
</tr>
</tbody>
</table>
<table class="table resultado">
<tbody>
<tr>
<td>Alunos Participantes</td>
<td></td>
</tr>
<tr>
<td>Alunos Aprovados</td>
<td> ?????</td>
</tr>
<tr>
<td>Alunos Reprovados</td>
<td>????? </td>
</tr>
<tr>
<td>Media dos Alunos</td>
<td></td>
</tr>
</tbody>
</table>
</div>
Stella, you did not solve the previous question that you asked before this and that deals with the same subject rs... please read on the page [tour] to know the site systematics. It is quick thing and will help you a lot to know how it works. Abs!
– Sam
That way it became very complicated to count approved and disapproved. Your other question, which didn’t have this complete code, made it easy to suggest counting the values that way, but it really isn’t.
– Sam