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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
| <html>
<head>
<script type="text/javascript">
/*Debut du code javascript */
//Fonction pour transferer des fond du compte courant à l'epargne
function courant_to_epargne(var1, var2, var3, var4, var5, var6)
{
var gallion_courant = window.document.forms['modif_compte'].elements[var1].value;
var mornille_courant = window.document.forms['modif_compte'].elements[var2].value;
var noise_courant = window.document.forms['modif_compte'].elements[var3].value;
var gallion_epargne = window.document.forms['modif_compte'].elements[var4].value;
var mornille_epargne = window.document.forms['modif_compte'].elements[var5].value;
var noise_epargne = window.document.forms['modif_compte'].elements[var6].value;
noise_courant = noise_courant - 1;
/* Dans le cas ou le compte est a sec */
if(( noise_courant < 0 ) && ( mornille_courant >= 0 ) && ( gallion_courant >= 0 ))
{
noise_courant = 0;
}
/* Dans le cas ou les noises sont à zéro mais où il reste de l'argent */
else if(( noise_courant <= 0 ) && ( mornille_courant > 0 ))
{
mornille_courant = mornille_courant - 1;
noise_courant = 28;
}
/* Dans le cas ou il ne reste que des galions */
else if(( noise_courant <= 0 ) && ( mornille_courant <= 0 ) && ( gallion_courant > 0 ))
{
gallion_courant = gallion_courant - 1;
mornille_courant = 16;
noise_courant = 28;
}
else
{
noise_epargne = noise_epargne - - 1;
}
/*Verification pour le passage d'une unite de monnaie a une autre*/
if(noise_epargne >= 29)
{
mornille_epargne = mornille_epargne - - 1;
noise_epargne = 0;
}
if(mornille_epargne >= 17)
{
gallion_epargne = gallion_epargne - - 1;
mornille_epargne = 0;
}
window.document.forms['modif_compte'].elements[var1].value = gallion_courant;
window.document.forms['modif_compte'].elements[var2].value = mornille_courant;
window.document.forms['modif_compte'].elements[var3].value = noise_courant;
window.document.forms['modif_compte'].elements[var4].value = gallion_epargne;
window.document.forms['modif_compte'].elements[var5].value = mornille_epargne;
window.document.forms['modif_compte'].elements[var6].value = noise_epargne;
}
//Fonction pour transferer de l'argent de l'epargne au compte courant
function epargne_to_courant(var1, var2, var3, var4, var5, var6)
{
var gallion_courant = window.document.forms['modif_compte'].elements[var1].value;
var mornille_courant = window.document.forms['modif_compte'].elements[var2].value;
var noise_courant = window.document.forms['modif_compte'].elements[var3].value;
var gallion_epargne = window.document.forms['modif_compte'].elements[var4].value;
var mornille_epargne = window.document.forms['modif_compte'].elements[var5].value;
var noise_epargne = window.document.forms['modif_compte'].elements[var6].value;
noise_courant = noise_courant - 1;
/* Dans le cas ou le compte est a sec */
if(( noise_epargne < 0 ) && ( mornille_epargne >= 0 ) && ( gallion_epargne >= 0 ))
{
noise_epargne = 0;
}
/* Dans le cas ou les noises sont à zéro mais où il reste de l'argent */
else if(( noise_epargne <= 0 ) && ( mornille_epargne > 0 ))
{
mornille_epargne = mornille_epargne - 1;
noise_epargne = 28;
}
/* Dans le cas ou il ne reste que des galions */
else if(( noise_epargne <= 0 ) && ( mornille_epargne <= 0 ) && ( gallion_epargne > 0 ))
{
gallion_epargne = gallion_epargne - 1;
mornille_epargne = 16;
noise_epargne = 28;
}
else
{
noise_courant = noise_courant - - 1;
}
/*Verification pour le passage d'une unite de monnaie a une autre*/
if(noise_courant >= 29)
{
mornille_courant = mornille_courant - - 1;
noise_courant = 0;
}
if(mornille_courant >= 17)
{
gallion_courant = gallion_courant - - 1;
mornille_courant = 0;
}
window.document.forms['modif_compte'].elements[var1].value = gallion_courant;
window.document.forms['modif_compte'].elements[var2].value = mornille_courant;
window.document.forms['modif_compte'].elements[var3].value = noise_courant;
window.document.forms['modif_compte'].elements[var4].value = gallion_epargne;
window.document.forms['modif_compte'].elements[var5].value = mornille_epargne;
window.document.forms['modif_compte'].elements[var6].value = noise_epargne;
}
</script>
</head>
<body>
<form name="modif_compte" action="" method="POST">
Compte courant:
<input type="text" name="gallion_courant" value="4" size="4" /> Gallions
<input type="text" name="mornille_courant" value="2" size="4" /> Mornilles
<input type="text" name="noise_courant" value="14" size="4" /> Noises
<br />
Epargne :
<input type="text" name="gallion_epargne" value="0" size="4" /> Gallions
<input type="text" name="mornille_epargne" value="0" size="4" /> Mornilles
<input type="text" name="noise_epargne" value="26" size="4" /> Noises
<br /><br />
<input name="button2" type="button" onClick="epargne_to_courant('gallion_courant','mornille_courant','noise_courant','gallion_epargne','mornille_epargne','noise_epargne')" value="Epargne vers courant" size="80">
<input name="button2" type="button" onClick="courant_to_epargne('gallion_courant','mornille_courant','noise_courant','gallion_epargne','mornille_epargne','noise_epargne')" value="Courant vers epargne" size="80">
</form>
</body>
</html> |
Partager