Besoin d'aide : Total prix TTC !
Résolu/Fermé
MWebMora
-
29 mars 2013 à 11:30
prosthetiks Messages postés 1189 Date d'inscription dimanche 7 octobre 2007 Statut Membre Dernière intervention 12 juin 2020 - 29 mars 2013 à 13:12
prosthetiks Messages postés 1189 Date d'inscription dimanche 7 octobre 2007 Statut Membre Dernière intervention 12 juin 2020 - 29 mars 2013 à 13:12
4 réponses
Salut ,
t'as le droit d'utiliser jQuery ? ou tu dois oblgiatoirement utilisé les fonctions javascript natif ?
t'as le droit d'utiliser jQuery ? ou tu dois oblgiatoirement utilisé les fonctions javascript natif ?
bg62
Messages postés
23590
Date d'inscription
samedi 22 octobre 2005
Statut
Modérateur
Dernière intervention
15 avril 2024
2 362
29 mars 2013 à 12:06
29 mars 2013 à 12:06
Je suis nouvelle sur le forum
ça se voit, mais pas grave ...
- 1 inscrit serait bien mieux (en plus = gratuit !)
- 2 avant toutes demandes précises (JavaScript) = être sur de chez sur de maîtriser au mois les bases du codage ...
:)
merci
prosthetiks
Messages postés
1189
Date d'inscription
dimanche 7 octobre 2007
Statut
Membre
Dernière intervention
12 juin 2020
431
Modifié par prosthetiks le 29/03/2013 à 13:03
Modifié par prosthetiks le 29/03/2013 à 13:03
Salut,
voila. Bon examen ;)
voila. Bon examen ;)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Examen Javascript</title> <script language="Javascript" > function CalculTTC(){ // déclarations des variables var somme = parseFloat(document.getElementById('q1').value); if(somme / somme == 1){ var produit = document.getElementById('q2').value; var comission = calculePourcent(document.getElementById('q3').value, somme); var tva = calculePourcent(document.getElementById('q4').value, somme); return 'Montant total: ' + (somme + comission + tva) + '€. Comission: '+comission+'€. TVA: ' + tva + '€.'; }else{ return 'Veuillez entrer un nombre'; } } function calculePourcent(pourcent, somme){ return parseFloat(somme * pourcent / 100); } </script> </head> <body> <h1>Calcul TTC</h1> <form id="examenjavascript"> <table border="0" cellpadding="5" cellspacing="20"> <tr> <td>Valeur:</td> <td> <input name="q1" type="text" id="q1" size="30" maxlength="30" /> </td> </tr> <tr> <td>Produit :</td> <td> <select name="q2" id="q2"> <option value="Produit A">Produit A</option> <option value="Produit B">Produit B</option> <option value="Produit C">Produit C</option> </select> </td> </tr> <tr> <td>Commission :</td> <td> <select name="q3" id="q3"> <option value="5">5 %</option> <option value="10">10 %</option> <option value="15">15 %</option> </select> </td> </tr> <tr> <td>TVA :</td> <td> <select name="q4" id="q4"> <option value="19.6">19.6 %</option> <option value="5.5">5.5 %</option> </select> </td> </tr> </table> <input name="button" type="button" value="Calculer mon montant TTC" onClick="alert(CalculTTC());" /> </form> </body> </html>
MWebMora
Messages postés
1
Date d'inscription
vendredi 29 mars 2013
Statut
Membre
Dernière intervention
29 mars 2013
29 mars 2013 à 13:10
29 mars 2013 à 13:10
Merci !
prosthetiks
Messages postés
1189
Date d'inscription
dimanche 7 octobre 2007
Statut
Membre
Dernière intervention
12 juin 2020
431
29 mars 2013 à 13:12
29 mars 2013 à 13:12
de rien !