Bonjour,
voici le JS que j'ai fait cette aprem:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <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:
Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" name="form"> <label for="addforscript" class="black13">choisissez votre quantité : </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.paypal.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?
ou sinon d'ou cela peut-il venir?
merci!
Partager