JS de calcul de tarifs d'envoi pour paypal

Fermé
Judes-Emile Bornes IV Messages postés 123 Date d'inscription dimanche 6 avril 2008 Statut Membre Dernière intervention 23 février 2010 - 2 févr. 2009 à 21:47
Bonjour,
voici le JS que j'ai fait cette aprem:
<script type="text/javascript">
/*script poids/prix pour achats paypal*/
function valider() {
input=document.form.add.nombre.value.length;
if (input==0) {
	alert("veuillez entrer un nombre SVP !");
}
function verif() {
n=document.form.add.nombre.value;
if (isNaN(n) || n==0) {
	alert("veuillez entrer un nombre SVP !");
}

w=document.form.weight.nombre.value;

if (w >=0 && w<= 0.5) {shipping = 5.30;}
if (w >=0.5 && w<= 1) {shipping = 6.30;}
if (w >=1 && w<= 2) {shipping = 7.40;}
if (w >=2 && w<= 3) {shipping = 8.30;}
if (w >=3 && w<= 5) {shipping = 10.10;}
if (w >=5 && w<= 7) {shipping = 11.90;}
if (w >=7 && w<= 10) {shipping = 14.60;}
if (w >=10 && w<= 15) {shipping = 16.60;}
if (w >=15 && w<= 30) {shipping = 22.60;}

var shippingamount = n*shipping;

a=document.form.amount.nombre.value;

amountwithoutshipping=n*a

var amount = amountwithoutshipping+shippingamount;

document.form.amount.nombre.value = amount;


</script>

Mes problèmes sont les suivants:
1. les messages alert sont chuintés par l'action du formulaire suivant:
<form  target="paypal" action="https://www.paypal.com/fr/home" name="form">
<label for="addforscript" class="black13">choisissez votre quantité :&nbsp;</label>
<input type="text" name="add" size="5" class="black11" value="">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="franck@wbrecup.com">
<input type="hidden" name="item_name" value="Carnet de Mission / PhnomPenh">
<input type="hidden" name="amount" value="23.00">
<input type="hidden" name="amount" value="amount">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="weight" value="1">
<input type="hidden" name="weight_unit" value="kgs">
<input type="hidden" name="lc" value="FR">
<input type="hidden" name="bn" value="PP-ShopCartBF"><br/><br/>
<input type="image" src="https://www.paypalobjects.com/fr_FR/FR/i/btn/btn_cart_SM.gif" border="0" name="submit" alt="Effectuez vos paiements via PayPal : une solution rapide, gratuite et sécurisée">
</form>


2.LE PLUS IMPORTANT:
paypal m'indique une erreur dans le libellé du prix après son passage dans le JS
un problème de virgule au lieu d'un point, ou autre?

si c'est le cas comment convertir un nombre à virgule en nombre à point?

merci!