Bonsoir à tous !

Je me suis lancée il y a peu dans le codage, et j’apprécie beaucoup. Cependant il m'arrive parfois de butter sur des problèmes que je n'arrive pas à résoudre seule.

Je suis en train de coder un programme permettant de déterminer une somme à partir de plusieurs critères. Voici donc le code:

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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
          <html>
            <head>
              <meta  content="text/html; charset=windows-1252"  http-equiv="content-type">
              <title>Programmateur CA max</title>
              <script  type="text/javascript"  src="chemin/vers/fichier_javascript.js"></script>
              <script>
               if ("Jeux";"oui"){ci_poulain=ci_poulain+60}
              Else {ci_poulain=ci_poulain}
 
                $( "input[jeux='oui']" ).val( "ci_poulain+60" );
              </script>
            </head>
            <body  style="             background-color: #E1E1E1;"><br>
              <br>
              <div  style="background-color:#FFFFFF; width: 1000px; margin:auto; border-radius: 20px;">
                <form  action="calcul"  method="post"> <input
 
                     name="action"  value="skill0"  type="hidden"><strong></strong>
                  <div  align="left">
                    <p  style="text-align: center;"  class="link1"><font  face="Arial, Helvetica, sans-serif"
 
                         size="3"><strong><br>
                        </strong></font></p>
                    <p  style="text-align: center;"  class="link1"><font  face="Arial, Helvetica, sans-serif"
 
                         size="3"><strong><span  style="font-family: serif;"></span>Critères
                          des parents<br>
                        </strong></font></p>
                  </div>
                  <table  style="width: 750px; height: 162px;"  align="center"  bgcolor="#C6D18F"
 
                     border="0"  cellpadding="5"  cellspacing="0">
                    <tbody>
                      <tr>
                        <td  style="text-align: center;"  colspan="2"><span  style="color: rgb(255, 255, 255);"><font
 
                               face="Arial, Helvetica, sans-serif"  size="2"><font
 
                                 class="link1"  size="3"><strong>Père : </strong></font></font></span></td>
                        <td  style="text-align: center;"  colspan="2"><span  style="color: rgb(255, 255, 255);"><font
 
                               face="Arial, Helvetica, sans-serif"  size="2"><font
 
                                 class="link1"  size="3"><strong>Mère : </strong></font></font></span></td>
                      </tr>
                      <tr>
                        <td  style="height: 27px; text-align: center;"  width="105"><span
 
                             role="timer"  style="color: rgb(255, 255, 255);">PG
                            Total </span></td>
                        <td  style="height: 27px; text-align: center;"  width="152">
                          <input  name="pg_pere"  style="background-color: #FFFFFF; color: #C6D18F; font-size:10pt"
 
                             value="0.00"  size="6"  maxlength="6"  type="text">
                        </td>
                        <td  style="height: 27px; text-align: center;"  width="105"><span
 
                             style="color: rgb(255, 255, 255);">PG Total </span></td>
                        <td  style="height: 27px; text-align: center;"  width="155">
                          <input  name="pg_mere"  style="background-color: #FFFFF; color: #C6D18F; font-size:10pt"
 
                             value="0.00"  size="6"  maxlength="6"  type="text">
                        </td>
                      </tr>
                      <tr>
                        <td  style="text-align: center;"  width="105"><span  style="color: rgb(255, 255, 255);">BLUP<br>
                          </span></td>
                        <td  style="text-align: center;"  width="152">&nbsp; <font
 
                             size="3"><span  style="font-family: Arial,Helvetica,sans-serif;"><span
 
                                 style="font-weight: bold;"></span></span></font><input
 
                             name="blup_pere"  style="background-color: #FFFFFF; color: #C6D18F; font-size:10pt"
 
                             value="0.00"  size="6"  maxlength="6"  type="text">&nbsp;
                          </td>
                        <td  style="text-align: center;"  width="105"><span  style="color: rgb(255, 255, 255);">BLUP</span></td>
                        <td  style="text-align: center;"  width="155"> <input  name="blup_mere"
 
                             style="background-color: #FFFFFF; color: #C6D18F; font-size:10pt"
 
                             value="0.00"  size="6
                        "  maxlength="6"  type="text"> </td>
                      </tr>
                      <tr  align="center">
                        <td  style="height: 59px;"  colspan="3"  height="39">
                          <ul>
                          </ul>
                          <div  style="text-align: center; margin-left: 160px;"><span
 
                               style="color: rgb(255, 255, 255);"><img  src="file:///C:/Users/morga_000/Desktop/larmes-aphrodite.png"
 
                                 height="24"  width="24"> </span><span  style="color: rgb(255, 255, 255);"><strong>Larmes
                                d'Aphrodite</strong>&nbsp; <label>(CI x
                                1,5)&nbsp; </label></span><span  style="color: rgb(255, 255, 255);"><label><input
 
                                   name="aphrodite"  value="oui"  type="radio">
                                oui&nbsp;</label> <label> <input  name="aphrodite"
 
                                   value="non"  checked="checked"  type="radio">
                                non</label></span></div>
                        </td>
                      </tr>
                    </tbody>
                  </table>
                  <div  align="left">
                    <p  style="text-align: center;"  class="link1"><font  face="Arial, Helvetica, sans-serif"
 
                         size="3"><strong>Critères du poulain</strong></font></p>
                    <table  style="width: 750px; height: 28px;"  align="center"
 
                       bgcolor="#C6D18F"  border="0"  cellpadding="5"  cellspacing="0">
                      <tbody>
                        <tr>
                          <td  style="text-align: center;"  width="105"><span  role="timer"
 
                               style="color: rgb(255, 255, 255);"><span  style="font-weight: bold;">CI
                                du poulain</span></span></td>
                          <td  style="text-align: center;"  width="152">
                            <div  style="margin-left: 80px;"><span  role="timer"
 
                                 style="color: rgb(255, 255, 255);"><span  style="font-weight: bold;"></span></span><input
 
                                 name="ci_poulain"  onblur="document.getElementById('ci_poulain').value = this.value;" style="background-color: #FFFFFF; color: #C6D18F; font-size:10pt"
 
                                 value="0.00"  size="6"  maxlength="6"  type="text">
                            </div>
                          </td>
                        </tr>
                      </tbody>
                    </table>
                  </div>
                  <table  style="width: 750px; height: 160px;"  align="center"  bgcolor="#C6D18F"
 
                     border="0"  cellpadding="5"  cellspacing="0">
                    <tbody>
                      <tr>
                        <td  style="height: 161px;">
                          <ul>
                          </ul>
                          <div  style="text-align: left; margin-left: 80px;"><span
 
                               style="color: rgb(255, 255, 255);"><strong><img  src="file:///C:/Users/morga_000/Desktop/jeu.png"
 
                                   align="absmiddle"  height="20"  hspace="3"  width="20">&nbsp;
                                </strong></span><span  style="color: rgb(255, 255, 255);"><strong><span
 
                                   style="font-weight: bold;">Jeux du poulain:</span>
                                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;
                                &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; <strong></strong></strong></span><span
 
                               style="color: rgb(255, 255, 255);"><label><input
 
                                   name="jeux"  value="oui"  type="radio">
                                oui&nbsp;</label> <label><input  name="jeux"  value="non"
 
                                   checked="checked"  type="radio" onblur="document.getElementById('jeux')"> non</label></span><span
 
                               style="color: rgb(255, 255, 255);"></span><br>
                            <span  style="color: rgb(255, 255, 255);"><img  style="width: 24px; height: 24px;"
 
                                 src="file:///C:/Users/morga_000/Desktop/eau-jouvence.png"
 
                                 align="absmiddle">&nbsp; </span><span  style="color: rgb(255, 255, 255);"><strong>L'eau
                                de Jouvence: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                              </strong></span><span  style="color: rgb(255, 255, 255);"><strong>&nbsp;
                                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;
                                &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; </strong><label><input
 
                                   name="jouvence"  value="oui"  type="radio">
                                oui&nbsp;</label> <label> <input  name="jouvence"
 
                                   value="non"  checked="checked"  type="radio">
                                non</label></span><br>
                            <span  style="color: rgb(255, 255, 255);"><strong> <img
 
                                   src="file:///C:/Users/morga_000/Desktop/lecon.png"
 
                                   align="absmiddle"  height="24"  width="24">&nbsp;
                                </strong></span><span  style="color: rgb(255, 255, 255);"><strong>Les
                                leçons: </strong>1 leçon par jour<strong>
                                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                                &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;
                                &nbsp; &nbsp; &nbsp; &nbsp;</strong> <label> <input
 
                                   name="nblecon"  value="1"  type="radio">
                                oui&nbsp;</label> <label> <input  name="nblecon"
 
                                   value="0"  checked="checked"  type="radio">
                                non</label></span><br>
                            <span  style="color: rgb(255, 255, 255);"><strong><img
 
                                   src="file:///C:/Users/morga_000/Desktop/centre.png"
 
                                   align="absmiddle"  height="24"  width="24">&nbsp;
                                </strong></span><span  style="color: rgb(255, 255, 255);"><strong>Le
                                Centre equestre: &nbsp; &nbsp; &nbsp; &nbsp;
                                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
                                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
                                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                                &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</strong>
                              <select  name="lecon"  style="background-color: rgb(255, 255, 255); font-size: 10pt;">
                                <option  value="0.255">0.255 </option>
                                <option  value="0.254">0.254 </option>
                                <option  value="0.253">0.253 </option>
                                <option  value="0.252">0.252 </option>
                                <option  value="0.251">0.251 </option>
                                <option  value="0.250">0.250 </option>
                                <option  value="0.249">0.249 </option>
                                <option  value="0.248">0.248 </option>
                                <option  value="0.247">0.247 </option>
                                <option  value="0.246">0.246 </option>
                                <option  value="0.245">0.245</option>
                                <option  value="0.244">0.244 </option>
                                <option  value="0.243">0.243 </option>
                                <option  value="0.242">0.242 </option>
                                <option  value="0.241">0.241 </option>
                                <option  value="0.240">0.240 </option>
                                <option  value="0.239">0.239 </option>
                                <option  value="0.238">0.238 </option>
                                <option  value="0.237">0.237 </option>
                                <option  value="0.236">0.236 </option>
                                <option  value="0.235">0.235 </option>
                                <option  value="0.234">0.234 </option>
                                <option  value="0.233">0.233 </option>
                                <option  value="0.232">0.232 </option>
                                <option  value="0.231">0.231 </option>
                                <option  value="0.230">0.230 </option>
                                <option  value="0.229">0.229 </option>
                                <option  value="0.228">0.228 </option>
                                <option  value="0.227">0.227 </option>
                                <option  value="0.226">0.226 </option>
                                <option  value="0.225">0.225 </option>
                                <option  value="0.224">0.224 </option>
                                <option  value="0.223">0.223 </option>
                                <option  value="0.222">0.222 </option>
                                <option  value="0.221">0.221 </option>
                                <option  value="0.220">0.220 </option>
                                <option  value="0.219">0.219 </option>
                                <option  value="0.218">0.218 </option>
                                <option  value="0.217">0.217 </option>
                                <option  value="0.216">0.216 </option>
                                <option  value="0.215">0.215 </option>
                                <option  value="0.214">0.214 </option>
                                <option  value="0.213">0.213 </option>
                                <option  value="0.212">0.212 </option>
                                <option  value="0.211">0.211 </option>
                                <option  value="0.210"  selected="selected">0.210</option>
                              </select>
                            </span><br>
                            <span  style="color: rgb(255, 255, 255);"><strong><img
 
                                   src="file:///C:/Users/morga_000/Desktop/fragment-nuage.png"
 
                                   align="absmiddle"  height="24"  width="24">&nbsp;
                                </strong></span><span  style="color: rgb(255, 255, 255);"><strong>Les
                                fragments de nuages utilisés/a utiliser&nbsp;</strong>
                              :<span  style="font-weight: bold;"> &nbsp; &nbsp;
                                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                                &nbsp;</span>&nbsp;
                              <select  name="fragment"  style="background-color: rgb(255, 255, 255); font-size: 8pt;">
                                <option  value="0"  selected="selected">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>
                                <option  value="16">16 </option>
                                <option  value="17">17 </option>
                                <option  value="18">18 </option>
                                <option  value="19">19 </option>
                                <option  value="20">20 </option>
                              </select>
                            </span></div>
                          <ul>
                          </ul>
                        </td>
                      </tr>
                    </tbody>
                  </table>
                  <p  align="center"> <input  name="submit"  class="submit"  value="Calculer les CA max"
 
 type="submit">
 ou              
        <input  name="reset"  class="submit"  value="Recommencer"  type="reset"></p><p
 
 align="center"><br>
                  <input  disabled="disabled"  id="ci_poulain"  size="5"  type="text">
              </p></form></div></body></html>
Pour faire simple:

La valeur de base correspond au CI du poulain. En fonction des éléments séléctionnés par oui ou par non dans les input, il faut que j'ajoute x, y, ou z aux CI, avec x, y ou z nombres entiers. Cependant, je ne sais pas comment faire.

J'ai tenté avec If et Else en tentant:

If jeux value "oui",

Ci_poulain=ci_poulain+60

60 étant la valeur gagnée grace aux jeux. Mais celà ne fonctionne pas, alors pourriez vous m'aiguiller et me venir en aide ?

Plus en détail (Je laisse de coté la partie père et mère avec BLUP et PG)

Ce que je souhaiterais faire c'est :

ajouter aux CI:

- 60 si oui est ché pour les jeux

- nombre gagné grace au centre equestre * 138 lecons si l'eau de jouvence est cochée "non", *276 si l'eau de jouvence est cochée "oui"

- nombre de fragments de nuages * nombre gagné grace au centre equestre

J'ai mis une case qui affiche le nombre total des CI pour voir en temps réel si le calcul fonctionne.

D'autre part, je souhaiterais savoir comment afficher le résultat du calcul en cliquant sur "calculer les CA max. Je ne sais pas comment faire.

Merci d'avance pour votre aide,

Cordialement, Flowcon