Bonjour,
J'ai un beug, avec "Nostalgie" (nos) c'est une valeur négative et il aime pas.
Ensuite, je ne sais pas comment additionner certaines checkbox entre elles.
donc voici les chkbx a additionner entre elles:
acap + apha + afh + anos
acom + abel + avf
agp + sd
asd
dcap + dbdn + dpha + dtour
scom + dbel
dgp + dsd
<html>
function majScore(item,valCb){
var newScore = parseFloat(document.getElementById('score').value);
if (item.checked == true){
newScore = newScore+valCb+1;
}else{
newScore = newScore-valCb-1;
}
if(newScore < 0) {
newScore = 0;
}
document.getElementById('score').value=newScore;
document.getElementById('aa').value = document.getElementById('score').value;
}
</script>
</head>
<body>
<form>
<input type="hidden" id="score" name="score" size="6" value="0"><p>
<input id="aa" name="aa" size="6" value="0" readonly><p>
<table>
<th width="40px"></th><th width="30px">A</th><th width="30px">D</th><th width="40px"></th><th width="30px">A</th><th width="30px">D</th>
<tr height="45px">
<th style="background-image:url(grepo_battlesimulation/bonus/nos.png)" title="Nostalgie"/></th><th style="background-color:black"><input type='checkbox' id="nos" name="nos" onclick="majScore(this,(-0.1));"></th><th style="background-color:black"></th>
<th style="background-image:url(grepo_battlesimulation/bonus/gp.png)" title="Grande Prestresse"/></th><th style="background-color:black"><input type='checkbox' id="gp" name="gp" onclick="majScore(this,0.2);"></th><th style="background-color:black"><input type='checkbox' id="gp" name="gp" onclick="majScore(this,0.2);"></th>
</tr>
<tr height="45px">
<th style="background-image:url(grepo_battlesimulation/bonus/chance.png)" title="Chance"/></th><th style="background-color:black"></th><th style="background-color:black"><input onkeyup="somab(this.form)" id="chan" name="chan" type="text" style="width: 25px;" /></th>
<th style="background-image:url(grepo_battlesimulation/bonus/bel.png)" title="Bellier"/></th><th style="background-color:black"><input type='checkbox' id="bel" name="bel" onclick="majScore(this,0.1);"></th><th style="background-color:black"><input type='checkbox' id="bel" name="bel" onclick="majScore(this,0.1);"></th>
</tr>
<tr height="45px">
<th style="background-image:url(grepo_battlesimulation/bonus/moral.png)" title="Moral"/></th><th style="background-color:black"></th><th style="background-color:black"><input onkeyup="somab(this.form)" id="moral" name="moral" type="text" style="width: 25px;" /></th>
<th style="background-image:url(grepo_battlesimulation/bonus/pha.png)" title="Phalange"/></th><th style="background-color:black"><input type='checkbox' id="pha" name="pha" onclick="majScore(this,0.1);"></th><th style="background-color:black"><input type='checkbox' id="pha" name="pha" onclick="majScore(this,0.1);"></th>
</tr>
<tr height="45px">
<th style="background-image:url(grepo_battlesimulation/bonus/bdn.png)" title="Bonus de Nuit"/></th><th style="background-color:black"></th><th style="background-color:black"><input type='checkbox' id="bdn" name="bdn" onclick="majScore(this,1);"></th>
<th style="background-image:url(grepo_battlesimulation/bonus/tour.png)"/></th><th style="background-color:black"></th><th style="background-color:black"><input type='checkbox' id="tour" name="tour" onclick="majScore(this,0.1);"></th>
</tr>
<tr height="45px">
<th style="background-image:url(grepo_battlesimulation/bonus/com.png)" title="Commandant"/></th><th style="background-color:black"><input type='checkbox' id="com" name="com" onclick="majScore(this,0.2);"></th><th style="background-color:black"><input type='checkbox' id="com" name="com" onclick="majScore(this,0.2);"></th>
<th style="background-image:url(grepo_battlesimulation/bonus/fh.png)" title="Force Héroïque"/></th><th style="background-color:black"><input type='checkbox' id="fh" name="fh" onclick="majScore(this,0.1);"></th><th style="background-color:black"></th>
</tr>
<tr height="45px">
<th style="background-image:url(grepo_battlesimulation/bonus/cap.png)" title="Capitaine"/></th><th style="background-color:black"><input type='checkbox' id="cap" name="cap" onclick="majScore(this,0.2);"></th><th style="background-color:black"><input type='checkbox' id="cap" name="cap" onclick="majScore(this,0.2);"></th>
<th style="background-image:url(grepo_battlesimulation/bonus/vf.png)" title="Vent Favorable"/></th><th style="background-color:black"><input type='checkbox' id="vf" name="vf" onclick="majScore(this,0.1);"></th><th style="background-color:black"></th>
</tr>
<tr height="45px">
<th style="background-image:url(grepo_battlesimulation/bonus/sd.png)" title="Selection Divine"/></th><th style="background-color:black"><input type='checkbox' id="sd" name="sd" onclick="majScore(this,0.1);"></th><th style="background-color:black"><input type='checkbox' id="sd" name="sd" onclick="majScore(this,0.1);"></th>
<th style="background-image:url(grepo_battlesimulation/bonus/cdc.png)" title="Concentration de la chasseresse"></th><th style="background-color:black"><input type='checkbox' id="cdc" name="cdc" onclick="majScore(this,0.15);"></th><th style="background-color:black"></th>
</tr>
<tr height="45px">
<th style="background-image:url(grepo_battlesimulation/bonus/remp.png)"title="Remparts"></></th><th style="background-color:black" colspan="5"><input onkeyup="somab(this.form)" id="lvl" name="lvl" type="text" style="width: 40px;" value="0" /></th>
</tr>
</table>
</form>
</body>
</html>
Merci de votre aide
Afficher la suite
30 oct. 2012 à 15:13