Aller au contenu

Fer24

Membre
  • Compteur de contenus

    1
  • Inscrit(e) le

  • Dernière visite

Réputation sur la communauté

0 Neutre

À propos de Fer24

  • Date de naissance 08/05/1943

Information du profil

  • Genre
    Homme
  1. Bonsoir, J´ai repris la gestion du site d´un club. Pour participer aux activités il existe un formulaire d´inscription qui calcule automatiquement le prix à payer. Ce calcul s´effectue très bien avec internet explorer par contre avec firefox et google chrome les calculs ne se font pas. Je suis incapable de voir où est l´incompatibilité. Je copie ci-dessous une partie des sources. <input type="text" name="Inscription" size="3" value="0" priorval="0" price="6.00" onchange="this.form.total.value=checkchoice(this);"> Et voici la routine de calcul qui ne fonctionne que avec internet explorer: <script LANGUAGE="JavaScript"> <!-- Begin function checkchoice(whichbox) { with (whichbox.form) { if (isNaN(whichbox.value)) { whichbox.value = whichbox.priorval; whichbox.focus(); } whichbox.value = Math.abs(whichbox.value); var dec = whichbox.value.indexOf('.', 1); if (dec > 0) { alert('Un nombre entier SVP pour \"' +whichbox.name +'\" !'); whichbox.value = whichbox.priorval; whichbox.focus(); } hiddentotal.value = eval(hiddentotal.value) - eval(whichbox.price * whichbox.priorval); whichbox.priorval = whichbox.value; hiddentotal.value = eval(hiddentotal.value) + eval(whichbox.price * whichbox.value); return(formatcurrency(hiddentotal.value)); } } function formatcurrency(num) { num = num.toString().replace(/\€|\,/g,''); if(isNaN(num)) num = "0"; cents = Math.floor((num * 100 + 0.5) % 100); num = Math.floor((num * 100 + 0.5) / 100).toString(); if(cents < 10) cents = "0" + cents; for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++) num = num.substring(0,num.length - (4 * i + 3))+' '+num.substring(num.length-(4 * i + 3)); return (num + "," + cents +" Euros"); } function InitForm() { document.myform.total.value = '0'; document.myform.hiddentotal.value = 0; for (xx = 9; xx < document.myform.elements.length; xx++) { /*<!-- chiffre 9 a modifier suivant Nbre de champs -->*/ if (document.myform.elements[xx].type == 'text') { document.myform.elements[xx].value = ""; } } } // End --> </script> Je vous remercie à l´avance pour votre avis
×
×
  • Créer...