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
| <script>
function calcul()
{
var total = 0;
var nb;
nb = document.form.coche.length;
document.getElementById("prix_total0").value = 1;
for( i = 0 ; i < nb ; i++ ) {
if (document.form.coche[i].checked)
{
var montableau = (document.form.coche[i].value).split(",");
document.getElementById("prix_total0").value = Math.round(parseFloat(document.getElementById("prix_total0").value) * parseFloat(montableau[0])*100)/100;
}
}
}
</script>
<?php
$france= array("produit1" =>"Table", "prix1" => array( "Design" => 1.96),
"produit2" =>"Chaise", "prix2"=> array( "Bois" => 1.53));
?>
<form id="form" name="form">
<div id="prix">
<table class="prix">
<tr><td class="book"><input type="text" id="prix_total0" name="prix_total0" value="0" size="8" onFocus="this.blur()"/></td><td class="imgbook"></td></tr>
</table>
</div>
<table>
<tr>
<td class="matchs"><?php echo $france["produit1"];?></td>
<td><label class="label_check" for="sample-check"><input name="coche" id="sample-check" value="<?php echo $france['prix1'] ['Design'];?>" onclick="calcul()" type="checkbox" /></td></label>
</tr>
<tr>
<td class="matchs"><?php echo $france["produit2"];?></td>
<td><label class="label_check" for="sample-check2"><input name="coche" id="sample-check2" value="<?php echo $france['prix2'] ['Bois'];?>" onclick="calcul()" type="checkbox" /></td></label>
</tr>
</table>
</form> |
Partager