calculs ABCD
by toubia95
HTML
<table summary="ÉVALUATION DU TRAVAIL EN MILIEU PROFESSIONNEL
N°Etudiant : 31213551
NOM : Marie AGOSSOU
Parcours : P1
Stage du 23/06/2014 au 12/09/2014
Lieu : TECHNOSOL NORMANDIE ZI Ouest Rue de la Vigne 14650 CARPIQUET
Tuteur : M. Gilles TOUBIANA
Intitulé du stage : Reconnaissance de sol, réalisation et interprétation d'essais géotechniques, suivi des dossiers d'études, participation à la rédaction des rapports. - an array type question" class="question">
<colgroup class="col-responses">
<col width="40%" class="col-answers">
<col width="15%" class="odd">
<col width="15%" class="even">
<col width="15%" class="odd">
<col width="15%" class="even">
</colgroup>
<thead>
<tr>
<td> </td>
<th>A
<br>Excellent
<br>Travail</th>
<th>B
<br>Très bon
<br>Travail</th>
<th>C
<br>Bon
<br>Travail</th>
<th>D
<br>Travail
<br>insuffisant</th>
</tr>
</thead>
<tbody id="javatbd93754X5413X60806SQ001">
<tr class="array2">
<th class="answertext">Intégration (communication – travail en équipe)
<input type="hidden" value="" id="java93754X5413X60806SQ001" name="java93754X5413X60806SQ001">
</th>
<td class="answer_cell_00A">
<label for="answer93754X5413X60806SQ001-A">
<input type="radio" onclick="checkconditions(this.value, this.name, this.type)" title="A Excellent Travail " id="answer93754X5413X60806SQ001-A" value="A" name="93754X5413X60806SQ001" class="radio" checked>
</label>
</td>
<td class="answer_cell_00B">
<label for="answer93754X5413X60806SQ001-B">
<input type="radio" onclick="checkconditions(this.value,...
JavaScript
$('input[type=radio]').change(function () {
var i=1, selector="", res="", vala = 0,
valb = 0,
valc = 0,
vald = 0;
for (i = 1; i < 10; i++) {
selector = "93754X5413X60806SQ00" + i;
res = $("[name='" + selector + "']:checked").val();
if (res !== undefined) {
if (res == "A") {
vala++;
} else if (res == "B") {
valb++;
} else if (res == "C") {
valc++;
} else if (res == "D") {
vald++;
}
}
}
$('#test1').val(vala);
$('#test2').val(valb);
$('#test3').val(valc);
$('#test4').val(vald);
});
/*
var maxta = this.getField("Total-A").value;
var maxtb = this.getField("Total-B").value;
var maxtc = this.getField("Total-C").value;
var maxtd = this.getField("Total-D").value;
var totalarray = new Array(maxta, maxtb, maxtc, maxtd);
var totalmax = Math.max.apply(Math, totalarray);
if (maxtd == totalmax) {
this.getField("note").value = "D";
}
if (maxtc == totalmax) {
this.getField("note").value = "C";
}
if (maxtb == totalmax) {
this.getField("note").value = "B";
}
if (maxta == totalmax) {
this.getField("note").value = "A";
}
//
var GlobalFields = new Array("Entreprise-integration", "Entreprise-adaptation", "Entreprise-efficacite", "Entreprise-organisation", "Entreprise-profit", "Entreprise-acquisition", "Entreprise-initiative", "Entreprise-autonomie", "Entreprise-integrite");
var n=0, sum = 0, ta = 0, tb = 0, tc = 0, td = 0;
for ( var i=0; i<GlobalFields.length; i++) {
if (this.getField(GlobalFields[i]).value == "A") {ta=ta+1;}
if (this.getField(GlobalFields[i]).value == "B") {tb=tb+1;}
if (this.getField(GlobalFields[i]).value == "C") {tc=tc+1;}
if (this.getField(GlobalFields[i]).value == "D") {td=td+1;}
}
var totalarray = new Array(ta, tb, tc, td);
var totalmax = Math.max.apply(Math, totalarray);
if (td == totalmax)...