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
| <script type='text/javascript'>
function addTo(Cat){
if(Number(document.getElementById('distrib').value)<1){alert('plus de points à distribuer');
return false;}
document.getElementById(Cat).value=Number(document.getElementById(Cat).value)+1
document.getElementById("c"+Cat).innerHTML=document.getElementById(Cat).value
document.getElementById('distrib').value=Number(document.getElementById('distrib').value)-1;
return true;
}
function SubFrom(Cat){
if(Number(document.getElementById(Cat).value<1)){alert('plus de points à rendre');
return false;}
document.getElementById(Cat).value=Number(document.getElementById(Cat).value)-1;
document.getElementById("c"+Cat).innerHTML=document.getElementById(Cat).value;
document.getElementById('distrib').value=Number(document.getElementById('distrib').value)+1;
return true;
}
</script>
<style type='text/css'>
.categorie {text-align:right;}
.champs {border:inset 2px grey;
width:40px;
float:left;
padding-left:10px;
font-size:13px;
font-family:courrier;}
</style>
</head>
<body>
<p>
<div style="width:100px;float:left;">Total</div><input type='text' class="categorie" id='distrib' value="10" style='width:40px'/><br/>
<div style="width:100px;float:left;">catégorie 1</div><div class="champs" id="ccat_1"> </div><input type='hidden' class="categorie" id='cat_1' value="0" onfocus="this.blur()" style='width:40px'/><input type='button' value="+" onclick="addTo('cat_1',this)" style='width:20px'/><input type='button' value="-" onclick="SubFrom('cat_1')" style='width:20px'/><br />
<div style="width:100px;float:left;">catégorie 2</div><input type='hidden' class="categorie" id='cat_2' value="0" onfocus="this.blur()" style='width:40px'/><input type='button' value="+" onclick="addTo('cat_2')" style='width:20px'/><input type='button' value="-" onclick="SubFrom('cat_2')" style='width:20px'/><br />
<div style="width:100px;float:left;">catégorie 3</div><input type='hidden' class="categorie" id='cat_3' value="0" onfocus="this.blur()" style='width:40px'/><input type='button' value="+" onclick="addTo('cat_3')" style='width:20px'/><input type='button' value="-" onclick="SubFrom('cat_3')" style='width:20px'/><br /> |