1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| <script language="javascript">
function AfficheTotalDay(champ1, champ2) // champ1 :premiere partie du nom du select selectionné
//champ2:Deuxieme partir du nom du select selectionné
{
// On va chercher le nombre de lignes dans l'input caché
var nblignes=parseInt(document.forms['myform'].elements['nblignes'].value);
// Creation du jour selectionné
if (champ1==1){daytext="monday";}
if (champ1==2){daytext="tuesday";}
if (champ1==3){daytext="wednesday";} //On met dans daytext le nom du jour qu'on modifie
if (champ1==4){daytext="thursday";}
if (champ1==5){daytext="friday";}
champ2.toString(10);
// Conversion en String et concatenation du jour et du numero pour obtenir le nom du champs input selectionné
var total=0;
var totalweek=0;
var totalglobal=0;
for (i=1; i<=nblignes; i++)
{
champ=i;
champ.toString(10);
var jour=daytext.concat(champ);
var nouvelle=parseFloat(document.forms['myform'].eval(jour).options[document.forms['myform'].eval(jour).selectedIndex].value);
total=total+nouvelle;
}
// Calcul et creation du totalJOUR
var tot="total";
var totalday=tot.concat(daytext);
document.forms['myform'].eval(totalday).value=total;
if (document.forms['myform'].eval(totalday).value>1)
{
//document.myform.eval(totalday).style.backgroundColor='#CC0000';
//document.myform.eval(totalday).style.fontSize = '12pt';
document.forms['myform'].eval(totalday).style.border = "solid red 3px";
}
if (document.forms['myform'].eval(totalday).value<1.25)
{
//document.myform.eval(totalday).style.backgroundColor='#FFFFFF';
//document.myform.eval(toalday).style.border= "white";
document.forms['myform'].eval(totalday).style.border = "solid grey 1px";
}
// Recalcul du totalPROJETSEMAINE
var week="totalweek".concat(champ2)
var lundi="monday".concat(champ2);
var mardi="tuesday".concat(champ2);
var mercredi="wednesday".concat(champ2);
var jeudi="thursday".concat(champ2);
var vendredi="friday".concat(champ2);
totalweek=parseFloat(document.forms['myform'].eval(lundi).options[document.forms['myform'].eval(lundi).selectedIndex].value)+
parseFloat(document.forms['myform'].eval(mardi).options[document.forms['myform'].eval(mardi).selectedIndex].value)+
parseFloat(document.forms['myform'].eval(mercredi).options[document.forms['myform'].eval(mercredi).selectedIndex].value)+
parseFloat(document.forms['myform'].eval(jeudi).options[document.forms['myform'].eval(jeudi).selectedIndex].value)+
parseFloat(document.forms['myform'].eval(vendredi).options[document.forms['myform'].eval(vendredi).selectedIndex].value);
document.forms['myform'].eval(week).value=totalweek;
// Recalcul du totalGlobal
totalglobal=parseFloat(document.forms['myform'].totalmonday.value)+parseFloat(document.forms['myform'].totaltuesday.value)+parseFloat(document.forms['myform'].totalwednesday.value)
+parseFloat(document.forms['myform'].totalthursday.value)+parseFloat(document.forms['myform'].totalfriday.value);
document.forms['myform'].total.value=totalglobal;
} |