title: How to write a calculation in JS?
body: <p>If the amount is correct, then that amount appears in a dialog box if it is less than 150 €, or a 10% discount if more than 150 €, or a 20% if it is higher than 250 €.</p>
  
  <pre><code>&lt;form name="monForm" action="#" method="post"&gt;
      Montant de la facture : &lt;input type="text" name="montant" id="montant" /&gt;&lt;/br&gt;
      &lt;input type="button" onclick="paiement(document.monForm.montant.value)" name="valider" id="valider" value="Valider" /&gt;  
  &lt;/form&gt;
  
  &lt;script&gt;
  function paiement(montant)
  {
      if (montant == "" || isNaN(montant)) //Pour s'assurer que le champ est renseigné et est numérique
      {
          alert("Montant de la facture en erreur");
          return false;   
      }
  
      montant = parseInt (montant);
      if (isNaN(montant) == false &amp;&amp; montant &lt; 150 )
      {
          var mtn = document.getElementById("montant");
          alert('Le montant de la facture est : "'+mtn.value+"'");
      }
  
      if (isNaN(montant) == false &amp;&amp;  montant &gt; 150)
      {
          // calcul de la remise
          alert('Vous bénéficiez d une remise de : "'+remise.value+"'");
      }
  
      var j = 20;
      if (isNaN(montant) == false &amp;&amp;  montant &gt; 250)
      {
  
      }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>All what I want is to give : </p>
  
  <p>If amount is less than 250 euros the discount will be 20%
  And is is less than 150 euros the discount will be 10%</p>