IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

Calcul bouton radio et liste déroulante


Sujet :

JavaScript

  1. #1
    Candidat au Club
    Inscrit en
    Septembre 2007
    Messages
    2
    Détails du profil
    Informations forums :
    Inscription : Septembre 2007
    Messages : 2
    Points : 2
    Points
    2
    Par défaut Calcul bouton radio et liste déroulante
    Bonjour,

    je fais appelle a une ame charitable qui pourrais m'aider a resoudre mon probleme.

    j'essaye de faire une page HTML avec des champs cocher par des bouton radio et en fin de page une liste deroulante avec des choix de nombre.

    mon besoin serait de pouvoir affiché un resultat selon l'option cocher et le choix effectué dans la liste deroulante.

    le champs "prix A" devrait etre le calcul du prix de l'option cocher - la remise en % du choix de la liste deroulante.

    le champs "prix B" devrait etre le calcul du resultat precedament trouver (Prix A)/ 10

    auriez-vous la solution.

    code html actuelle.

    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
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    <head> 
    <html> 
    <body> 
    <table border="0" align="center"> 
    <tr> 
    <td>Type&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td> 
    <td>option 1</td> 
    <td>option 2</td> 
    <td>option 3</td> 
    </tr> 
    <tr> 
    <td>T150</td> 
    <td>178 € <INPUT type="radio" name="tarif" value="178" checked ></td> 
    <td>236 € <INPUT type="radio" name="tarif" value="236" ></td></td> 
    <td>350 € <INPUT type="radio" name="tarif" value="350" ></td></td> 
    <tr> 
    <td>T256</td> 
    <td>184 € <INPUT type="radio" name="tarif" value="184" ></td> 
    <td>240 € <INPUT type="radio" name="tarif" value="240" ></td> 
    <td>356 € <INPUT type="radio" name="tarif" value="356" ></td> 
    </tr> 
    </table> 
     
    <table> 
    <table border="0" align="center"> 
    <td>Remise&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td> 
    <td>Prix A&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td> 
    <td>Prix B</td> 
    </tr> 
    </table> 
    <table> 
    <table border="0" align="center"> 
    <td> 
    <select name="remise"> 
    <option value="0"> </option> 
    <option value="0"> 0</option> 
    <option value="0"> 1</option> 
    <option value="0"> 2</option> 
    <option value="0"> 3</option> 
    <option value="0"> 4</option> 
    <option value="0"> 5</option> 
    <option value="0"> 6</option> 
    <option value="0"> 7</option> 
    <option value="0"> 8</option> 
    <option value="0"> 9</option> 
    <option value="0"> 10</option> 
    <option value="0"> 11</option> 
    <option value="0"> 12</option> 
    <option value="0"> 13</option> 
    <option value="0"> 14</option> 
    <option value="0"> 15</option> 
    </select> 
    <td><input type="text" name="a" size="7" ></td> 
    <td><input type="text" name="b" size="7" ></td> 
    </tr> 
    </table> 
    <div align="center"><input type="button" value="Calcul" onclick="calcul();"></div> 
    </body></html>

  2. #2
    Membre du Club
    Inscrit en
    Mars 2007
    Messages
    75
    Détails du profil
    Informations forums :
    Inscription : Mars 2007
    Messages : 75
    Points : 61
    Points
    61
    Par défaut
    salut , te je conseille deja de revoir tes structure HTML car ya pas mal de souci de balise ( ouverture sans fermeture par exemple )

    J'ai corriger tout ca et je t'ai fais un petit truc dis moi si c'est ce que tu voulais

    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
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    <html> 
    <head>
    <title>Exo Javascript</title>
     
    <script language="Javascript">
     
    function calcul()
    {
    	s1=0;
     
    	if(document.f.tarif[0].checked==true){
    		s1=document.f.tarif[0].value;
    	}
    	else if(document.f.tarif[1].checked==true){
    		s1=document.f.tarif[1].value;
    	}
    	else if(document.f.tarif[2].checked==true){
    		s1=document.f.tarif[2].value;
    	}
    	else if(document.f.tarif[3].checked==true){
    		s1=document.f.tarif[3].value;
    	}
    	else if(document.f.tarif[4].checked==true){
    		s1=document.f.tarif[4].value;
    	}
    	else if(document.f.tarif[5].checked==true){
    		s1=document.f.tarif[5].value;
    	}
    	else if(document.f.tarif[6].checked==true){
    		s1=document.f.tarif[5].value;
    	}
     
    	document.f.a.value=s1*(document.f.remise.value/100);
    	document.f.b.value=document.f.a.value/10;
     
    }
     
    </script>
     
    </head> 
    <body> 
    <form name="f" method="POST">
    <table border="0" align="center"> 
     
    	<tr> 
    		<td width="30%">Type</td> 
    		<td>option 1</td> 
    		<td>option 2</td> 
    		<td>option 3</td> 
    	</tr> 
     
    	<tr> 
    		<td>T150</td> 
    		<td>178 € <INPUT type="radio" name="tarif" value="178" onclick="calcul()"></td> 
    		<td>236 € <INPUT type="radio" name="tarif" value="236" onclick="calcul()"></td>
    		<td>350 € <INPUT type="radio" name="tarif" value="350" onclick="calcul()"></td> 
    	</tr>
     
    	<tr> 
    		<td>T256</td> 
    		<td>184 € <INPUT type="radio" name="tarif" value="184" onclick="calcul()"></td> 
    		<td>240 € <INPUT type="radio" name="tarif" value="240" onclick="calcul()"></td> 
    		<td>356 € <INPUT type="radio" name="tarif" value="356" onclick="calcul()"></td> 
    	</tr> 
     
    </table> 
     
    <table border="0" align="center"> 
     
    	<tr>
    		<td width="25%">Remise</td> 
    		<td width="25%">Prix A</td> 
    		<td width="25%">Prix B</td> 
    	</tr> 
     
    </table> 
     
    <table border="0" align="center"> 
    	<tr>
    		<td> 
    			<select name="remise" onchange="calcul()"> 
    			<option> </option> 
    			<option value="0"> 0</option> 
    			<option value="1"> 1</option> 
    			<option value="2"> 2</option> 
    			<option value="3"> 3</option> 
    			<option value="4"> 4</option> 
    			<option value="5"> 5</option> 
    			<option value="6"> 6</option> 
    			<option value="7"> 7</option> 
    			<option value="8"> 8</option> 
    			<option value="9"> 9</option> 
    			<option value="10"> 10</option> 
    			<option value="11"> 11</option> 
    			<option value="12"> 12</option> 
    			<option value="13"> 13</option> 
    			<option value="14"> 14</option> 
    			<option value="15"> 15</option> 
    			</select> 
    		</td>	
    		<td><input type="text" name="a" size="7" ></td> 
    		<td><input type="text" name="b" size="7" ></td> 
    	</tr> 
    </table> 
     
    	<div align="center">
    		<input type="button" value="Calcul" onclick="calcul();">
    	</div> 
    </form>
    </body>
    </html>

  3. #3
    Candidat au Club
    Inscrit en
    Septembre 2007
    Messages
    2
    Détails du profil
    Informations forums :
    Inscription : Septembre 2007
    Messages : 2
    Points : 2
    Points
    2
    Par défaut
    Bonjour,

    merci beaucoup, c'est exactement cela.


    encore merci pour tout.


    Cdt

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 8
    Dernier message: 08/08/2009, 21h38
  2. Activer bouton submit selon liste déroulante
    Par zephben dans le forum Général JavaScript
    Réponses: 19
    Dernier message: 02/06/2009, 15h05
  3. Réaffichage de variables sur bouton radio et listes
    Par pasc06 dans le forum Langage
    Réponses: 1
    Dernier message: 14/10/2008, 09h57
  4. Problème avec un bouton lié à une liste déroulant
    Par valouche dans le forum Macros et VBA Excel
    Réponses: 4
    Dernier message: 01/06/2007, 13h55
  5. Réponses: 5
    Dernier message: 12/12/2006, 18h29

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo