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 :

Ajouter un nouveau champs par bouton + et création de variables


Sujet :

JavaScript

  1. #41
    Nouveau membre du Club
    Profil pro
    Étudiant
    Inscrit en
    Avril 2010
    Messages
    127
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2010
    Messages : 127
    Points : 36
    Points
    36
    Par défaut
    y'a que 41 lignes dans ton code ...
    et y'a surtout un
    } tout seul à la fin ...
    Je n'ai donné que le code en rapport avec ce sur quoi nous discutons, ce qui expliquerait le } tout seul, qui serait une faute de copier coller. Le code complet du générateur fait 435 lignes et n'a pas ce } tout seul:

    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
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    <?php
    function form_meta($wow)
    {
    echo'
    	<form id="form1" method="post" action="'.$wow.'">
    	
    		<table width="950" align="center" border="0" cellspacing="0" cellpadding="0" class="table" style="background-color:#929B98;">
    			<tr>
                <td valign="top" align="right" >Nom & Pr&eacute;nom du personnage: </td>
                <td valign="top" align="left" ><input name="nomperso" type="text" id="nomperso" size="25" maxlength="255" /></td>
              </tr>
    		  <tr>
                <td valign="top" align="right" >Sexe: </td>
                <td valign="top" align="left">
    			<input type="radio" name="sexe" value="Masculin" id="sexemale" /><label for="sexemale">♂</label>
    			<input type="radio" name="sexe" value="Féminin" id="sexefemelle" /> <label for="sexefemelle">♀</label>
    			<input type="radio" name="sexe" value="Indéfini ou asexué" id="sexeindefini" /> <label for="sexeindefinie">			Indéfini</label>
       </p>
    
    </td>
              </tr>
              <tr>
                <td valign="top" align="right" >&Acirc;ge du personnage: </td>
                <td valign="top" align="left"><input name="age" type="text" id="age" size="4" maxlength="4"> ans</td>
              </tr>
    		  <tr>
                <td valign="top" align="right" >Avatar du personnage (adresse image): </td>
                <td valign="top" align="left"><input name="avatar" type="text" id="avatar" size="35" maxlength="255"></td>
              </tr>
              <tr>
               <td valign="top" align="right" >Race </td>
                <td valign="top" align="left"><input name="race" type="text" id="race" size="15" maxlength="255"></td>
              </tr>
              <tr>
                <td valign="top" align="right" >Carri&egrave;re : <br /></td>
                <td valign="top" align="left"><input name="carriere" type="text" id="carriere" /></td>
              </tr>    
              <tr>
                <td valign="top" align="right" >Lieu de d&eacute;part: <br /></td>
                <td valign="top" align="left"><input name="depart" type="text" id="depart"></td>
              </tr>   
    		  <tr>
                <td valign="top" align="right" >Fr&eacute;quence de jeu: <br /></td>
                <td valign="top" align="left"><input name="frequence" type="text" id="frequence"></td>
              </tr>  
              <tr>
                <td valign="top" align="right" >Description physique du personnage (minimum 15 lignes compl&egrave;tes)<br /></td>
                <td valign="top" align="left"><textarea name="physique" cols="50" rows="2" id="physique"></textarea></td>
              </tr>
    		   <tr>
                <td valign="top" align="right" >Description psychologique du personnage (minimum 15 lignes compl&egrave;tes)<br /></td>
                <td valign="top" align="left"><textarea name="psycho" cols="50" rows="2" id="psycho"></textarea></td>
              </tr>
    		  <tr>
                <td valign="top" align="right" >Alignement du personnage: </td>
                <td valign="top" align="left"><input name="align" type="text" id="align" size="25" maxlength="255" /></td>
              </tr>
    		   <tr>
                <td valign="top" align="right" >Histoire du personnage (avant qu\'il ne commence l\'aventure ici) (minimum 20 lignes compl&egrave;tes)<br /></td>
                <td valign="top" align="left"><textarea name="histoire" cols="50" rows="2" id="histoire"></textarea></td>
              </tr>
    		  <tr>
                <td valign="top" align="right" >Vos comp&eacute;tence de d&eacute;part (et leurs descriptions !) (<a href="http://warforum-jdr.com/wiki-v2/doku.php?id=1.5_competences" target=_blank>r&egrave;gles</a>):<br /></td>
                <td valign="top" align="left"><textarea name="comp" cols="50" rows="2" id="comp"></textarea></td>
              </tr>
    		  <tr>
                <td valign="top" align="right" >Votre bourse de pistole de départ: <strong><a title="Souvent 50 pistoles, néanmoins certaines carrières peuvent proposer un petit bonus pécunier au départ. Les Marchands ont quant à eux 4000 pistoles de départ pour couvrir leurs frais d\'ouvertures de magasins et d\'achat d\'objets.">(?)</a></strong><br /></td>
                <td valign="top" align="left"><input name="bourse" type="text" id="bourse" size="4" maxlength="3"> Pistoles</td>
              </tr>
    		  <tr>
                <td valign="top" align="right" >Vos dotations initiales <strong><a title="Un personnage non marchand a droit à 2 objets raciaux (armes/armures) qui devront être en lien avec son background, et correspondre à sa vocation ! De plus, ils ne devront pas être exagéré (donc pas de hache à 2000 pistoles en commençant). Ces objets seront vérifiés par le MJ en charge du PJ. Il aura également droit à 5 objets usuels libre au choix.
    
    			
    || Un personnage marchand, lui, ne reçoit pas d\'objets de départ, mais une bourse assez conséquente en contrepartie.">(?)</a></strong>:<br /></td>
                <td valign="top" align="left">
    			
    			<table border="1" style="border-collapse:collapse">
      <tr>
        <td align="center"><input name="arma1nom" type="text" id="arma1nom" size="20" maxlength="255" value="Nom arme/armure" onclick="this.value=\'\';" /></td>
        <td align="center"><input name="arma1stat" type="text" id="arma1stat" size="20" maxlength="255" value="Caractéristiques" onclick="this.value=\'\';" /></td>
    	<td align="center"><input name="arma1autre" type="text" id="arma1autre" size="20" maxlength="255" value="Notes" onclick="this.value=\'\';" /></td>
      </tr>
      <tr>
        <td align="center"><input name="arma2nom" type="text" id="arma2nom" size="20" maxlength="255" value="Nom arme/armure" onclick="this.value=\'\';" /></td>
        <td align="center"><input name="arma2stat" type="text" id="arma2stat" size="20" maxlength="255" value="Caractéristiques" onclick="this.value=\'\';" /></td>
    	<td align="center"><input name="arma2autre" type="text" id="arma2autre" size="20" maxlength="255" value="Notes" onclick="this.value=\'\';" /></td>
      </tr>
      <tr>
        <td align="center"><input name="usu1" type="text" id="usu1" size="20" maxlength="255" value="Objet usuel" onclick="this.value=\'\';" /></td>
        <td align="center"><input name="usu2" type="text" id="usu2" size="20" maxlength="255" value="Objet usuel" onclick="this.value=\'\';" /></td>
    	</tr>
      <tr>
    	<td align="center"><input name="usu3" type="text" id="usu3" size="20" maxlength="255" value="Objet usuel" onclick="this.value=\'\';" /></td>
        <td align="center"><input name="usu4" type="text" id="usu4" size="20" maxlength="255" value="Objet usuel" onclick="this.value=\'\';" /></td>
      </tr>
       <tr>
    	<td colspan="2" align="center"><input name="usu5" type="text" id="usu5" size="20" maxlength="255" value="Objet usuel" onclick="this.value=\'\';" /></td>
    </td>
      </tr>
    </table>
    			
    			
    			
    			<br></td>
              </tr>
    		 
    		  <tr>
                <td valign="top" align="right"></td>
                <td valign="top" align="left">
    <fieldset id=\'Croyances\'>
                <legend>Croyance religieuse <BR />PAS ENCORE FONCTIONNEL, INSCRIVEZ LES INFOS DANS LE CADRE AUTRES TOUT EN BAS (<a href="http://warforum-jdr.com/wiki-v2/doku.php?id=3.7_regles_concernant_les_croyances" target=_blank>Points de croyances</a>):</legend>
                <input type=\'button\' value=\'Ajouter un Dieu\' onclick=\'Construct()\' /><br />
             </fieldset>	<br>
              </tr>
    		  <tr>
                <td valign="top" align="right" >Autres (<a href="http://warforum-jdr.com/wiki-v2/doku.php?id=3.7_regles_concernant_les_croyances" target=_blank>Points de croyances</a>, sorts (si classe sorcier), traits particuliers, notes, etc):<br /></td>
                <td valign="top" align="left"><textarea name="autre" cols="50" rows="2" id="autre"></textarea><br \></td>
              </tr>
                </table>
    <!-- debut demarche profil -->
    			<table width="950" align="center" border="0" cellspacing="0" cellpadding="0" class="table" align="justify" style="background-color:#929B98;">
    			<tr >
    				<th scope="col"></th>
    				<th scope="col">FOR</th>
    				<th scope="col">END</th>
    				<th scope="col">HAB</th>
    				<th scope="col">CHAR</th>
    				<th scope="col">INT</th>
    				<th scope="col">INI</th>
    				<th scope="col">PAR</th>
    				<th scope="col">ATT</th>
    			</tr>
    			<tr>
    				<th scope="row">Profil de base</th>
    				<td align="left"><input name="for1" onchange="javascript:computeResult(\'for\');" value="0" size="2" maxlength="2" /></td>
    				<td align="left"><input name="end1" onchange="javascript:computeResult(\'end\');" value="0" size="2" maxlength="2" /> 	</td>
    				<td align="left"><input name="hab1" onchange="javascript:computeResult(\'hab\');" value="0" size="2" maxlength="2" />  				</td>
    				<td align="left"><input name="char1" onchange="javascript:computeResult(\'char\');" value="0" size="2" maxlength="2" />  				</td>
    				<td align="left"><input name="int1" onchange="javascript:computeResult(\'int\');" value="0" size="2" maxlength="2" />  				</td>
    				<td align="left"><input name="ini1" onchange="javascript:computeResult(\'ini\');" value="0" size="2" maxlength="2" />  				</td>
    				<td align="left"><input name="par1" onchange="javascript:computeResult(\'par\');" value="0" size="2" maxlength="2" />  				</td>
    				<td align="left"><input name="att1" onchange="javascript:computeResult(\'att\');" value="0" size="2" maxlength="2" />  				</td>
    				
    
    			</tr>
    			<tr>
    				<th scope="row">Vos 5 PC</th>
    				<td align="left"><input name="for2" onchange="javascript:ma_verification(this); computeResult(\'for\');"
     value="0" size="2" maxlength="2" /> 			</td>
    				<td align="left"><input name="end2" onchange="javascript:ma_verification(this); computeResult(\'end\');"
     value="0" size="2" maxlength="2" /> 	</td>
    				<td align="left"><input name="hab2" onchange="javascript:ma_verification(this); computeResult(\'hab\');"
      value="0" size="2" maxlength="2" />  				</td>
    				<td align="left"><input name="char2" onchange="javascript:ma_verification(this); computeResult(\'char\');"
     value="0" size="2" maxlength="2" />  				</td>
    				<td align="left"><input name="int2" onchange="javascript:ma_verification(this); computeResult(\'int\');"
     value="0" size="2" maxlength="2" />  				</td>
    				<td align="left"><input name="ini2" onchange="javascript:ma_verification(this); computeResult(\'ini\');"
     value="0" size="2" maxlength="2" />  				</td>
    				<td align="left"><input name="par2" onchange="javascript:ma_verification(this); computeResult(\'par\');"
     value="0" size="2" maxlength="2" />  				</td>
    				<td align="left"><input name="att2" onchange="javascript:ma_verification(this); computeResult(\'att\');"
     value="0" size="2" maxlength="2" />  				</td
    			</tr>
    			<tr>
    				<th scope="row">Bonus/malus de classe (malus = nombre pr&eacute;c&eacute;d&eacute; d\'un - !)</th>
    				<td align="left"><input name="for3" onchange="javascript:ma_verification2(this); computeResult(\'for\');" value="0" size="2" maxlength="2" />					</td>
    				<td align="left"><input name="end3" onchange="javascript:ma_verification2(this); computeResult(\'end\');" value="0" size="2" maxlength="2" />	</td>
    				<td align="left"><input name="hab3" onchange="javascript:ma_verification2(this); computeResult(\'hab\');" value="0" size="2" maxlength="2" />  				</td>
    				<td align="left"><input name="char3" onchange="javascript:ma_verification2(this); computeResult(\'char\');" value="0" size="2" maxlength="2" />  				</td>
    				<td align="left"><input name="int3" onchange="javascript:ma_verification2(this); computeResult(\'int\');" value="0" size="2" maxlength="2" />  				</td>
    				<td align="left"><input name="ini3" onchange="javascript:ma_verification2(this); computeResult(\'ini\');" value="0" size="2" maxlength="2" />  				</td>
    				<td align="left"><input name="par3" onchange="javascript:ma_verification2(this); computeResult(\'par\');" value="0" size="2" maxlength="2" />  				</td>
    				<td align="left"><input name="att3" onchange="javascript:ma_verification2(this); computeResult(\'att\');" value="0" size="2" maxlength="2" />  				</td
    			</tr>
    			<tr>
    				<th scope="row">Profil final</th>
    				<td align="left"><input id="resultfor" name="resultfor" size="2" maxlength="2" readonly="readonly" /></td>
    				<td align="left"><input id="resultend" name="resultend" size="2" maxlength="2" readonly="readonly" /></td>
    				<td align="left"><input id="resulthab" name="resulthab" size="2" maxlength="2" readonly="readonly" /></td>
    				<td align="left"><input id="resultchar" name="resultchar" size="2" maxlength="2" readonly="readonly" />			  				</td>
    				<td align="left"><input id="resultint" name="resultint" size="2" maxlength="2" readonly="readonly" /></td>
    				<td align="left"><input id="resultini" name="resultini" size="2" maxlength="2" readonly="readonly" /></td>
    				<td align="left"><input id="resultpar" name="resultpar" size="2" maxlength="2" readonly="readonly" /></td>
    				<td align="left"><input id="resultatt" name="resultatt" size="2" maxlength="2" readonly="readonly" /></td>
    				
    
    			</tr>
    		</table><br \>
    		<center><input type="submit" value="G&eacute;n&eacute;rer la pr&eacute;sentation" /></center>
    		
        </form>';
    }
    
    
    function generation()
    {
    	
    	
    // les différentes variables sont exprimées ici
    
    	$nomperso = $_POST['nomperso'];
    	$avatar = $_POST['avatar'];
    	$age = $_POST['age'];
    	$sexe = $_POST['sexe'];
    	$race = $_POST['race'];
    	$carriere = $_POST['carriere'];
    	$depart = $_POST['depart'];
    	$frequence = $_POST['frequence'];
    	$physique = $_POST['physique'];
    	$psycho = $_POST['psycho'];
    	$align = $_POST['align'];
    	$histoire = $_POST['histoire'];	
    	$comp = $_POST['comp'];
    	$bourse = $_POST['bourse'];
    	$arma1nom = $_POST['arma1nom'];
    	$arma1stat = $_POST['arma1stat'];
    	$arma1autre = $_POST['arma1autre'];
    	$arma2nom = $_POST['arma2nom'];
    	$arma2stat = $_POST['arma2stat'];
    	$arma2autre = $_POST['arma2autre'];
    	$usu1 = $_POST['usu1'];	
    	$usu2 = $_POST['usu2'];
    	$usu3 = $_POST['usu3'];
    	$usu4 = $_POST['usu4'];
    	$usu5 = $_POST['usu5'];
    	$i=-1;
    	while($_POST['pdcname1'][++$i]
    	{
        $pdcname1[] = $_POST['pdcname1'][$i];
    	}
    	$i=-1;
    	while($_POST['pdcname2'][++$i]
            {
        $pdcname2[] = $_POST['pdcname2'][$i];
    	}
    	var_dump($pdcname1);
    	var_dump($pdcname2);
    	$autre = $_POST['autre'];
    	$resultfor = $_POST['resultfor'];
    	$resultend = $_POST['resultend'];
    	$resulthab = $_POST['resulthab'];
    	$resultchar = $_POST['resultchar'];
    	$resultint = $_POST['resultint'];
    	$resultini = $_POST['resultini'];
    	$resultpar = $_POST['resultpar'];
    	$resultatt = $_POST['resultatt'];
    	$enc1 = $resultend / 2;
    	$enc2 = $enc1 + 1;
    	$enc2 = floor($enc2);
    	$pv = $resultend * 5;
    
    echo 'Fenêtre n°1 avec le code à copier sur le forum: <form method="post" action=""><textarea name="code" onFocus="select()" rows="10" cols="70" readonly="readonly">
    
    Nom et Prénom: '.stripslashes($nomperso).'
    Sexe: '.stripslashes($sexe).'
    Age:  '.stripslashes($age).' ans
    Race: '.stripslashes($race).'
    Carrière: '.stripslashes($carriere).'
    Lieu/ville de départ: '.stripslashes($depart).'
    Fréquence de jeu: '.stripslashes($frequence).'
    Profil:  FOR '.stripslashes($resultfor).' / END '.stripslashes($resultend).' / HAB '.stripslashes($resulthab).' / CHAR '.stripslashes($resultchar).' / INT '.stripslashes($resultint).' / INI '.stripslashes($resultini).' / PAR '.stripslashes($resultpar).' / ATT '.stripslashes($resultatt).' / PV '.stripslashes($pv).'
    
    
    Description physique :
    '.stripslashes($physique).'
    Description psychologique :
    '.stripslashes($psycho).' Alignement : '.stripslashes($align).'
    Historique :
    '.stripslashes($histoire).'
    Compétences : '.stripslashes($comp).' Bourse: '.stripslashes($bourse).' Pistoles || Autres : Inventaire: '.stripslashes($arma1nom).' '.stripslashes($arma2nom).' '.stripslashes($usu1).' '.stripslashes($usu2).' '.stripslashes($usu3).' '.stripslashes($usu4).' '.stripslashes($usu5).'
    Autres: '.stripslashes($autre).'

    Code pour fiche
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
     
     
    <html><p style="text-align: center; font-family: verdana,geneva;  font-size: large; font-weight: bold; color: #6a94bd; text-decoration: underline;"></html>Informations générales sur le personnage :<html></p><center></html>
     
    |< 50em >|
    |  **Nom et Prénom:**  |  '.stripslashes($nomperso).'   |  <html><img src="'.stripslashes($avatar).'" /></html>  | 
    |  **Age:**   |  '.stripslashes($age).' ans    |  :::  |
    |  **Sexe: **  |    '.stripslashes($sexe).'   |  :::  | 
    |  **Race: **  |   '.stripslashes($race).'   |  :::  | 
    |  **Carrière: **  |  '.stripslashes($carriere).'  |  :::  | 
    |  **Lieu/ville de départ:**   |  '.stripslashes($depart).'  |   :::  |
    |  **Fréquence de jeu:**   |  '.stripslashes($frequence).'  |   :::  |
    |  **MJ:**   |  **à compléter**  |   :::  |
    <html><br></html>
     
     
    ^  FOR         ^  END           ^  HAB                            ^  CHAR                            ^  INT                            ^  INI                            ^  ATT                            ^  PAR                           ^  PV                            ^
    |  '.stripslashes($resultfor).'   |  '.stripslashes($resultend).'     |  '.stripslashes($resulthab).'                      |  '.stripslashes($resultchar).'                      |  '.stripslashes($resultint).'                      |  '.stripslashes($resultini).'                      |  '.stripslashes($resultpar).'                      |  '.stripslashes($resultatt).'                      |  '.stripslashes($pv).'                      | 
     
    <html><br></html>
    | **XP disponible:**  |  0     | 
    | **PC dépensés:**  |    5     | 
    | **PC disponibles:**  |   0   | 
    <html><br></center></html>
     
     
    ----
    ----
    <html><br></html>
    <html><img align="right" src="http://warforum-jdr.com/images/imgfiches/barre2.jpg" /></html>
    <html><p style="text-align: center; font-family: verdana,geneva;  font-size: large; font-weight: bold; color: #6a94bd; text-decoration: underline;"></html>Description physique :<html></p></html>
     
    '.stripslashes($physique).'
     
     
    <html><p style="text-align: center; font-family: verdana,geneva;  font-size: large; font-weight: bold; color: #6a94bd; text-decoration: underline;"></html>Description psychologique :<html></p></html>
     
    '.stripslashes($psycho).'
     
    __Alignement :__ '.stripslashes($align).'
     
     
    <html><p style="text-align: center; font-family: verdana,geneva;  font-size: large; font-weight: bold; color: #6a94bd; text-decoration: underline;"></html>Historique du personnage :<html></p></html>
     
    '.stripslashes($histoire).'
     
     
    <html><br></html>
     
    ----
    ----
    <html><br></html>
     
    <html><img align="left" src="http://warforum-jdr.com/images/imgfiches/barre4.jpg" /></html>  <html><p style="text-align: center; font-family: verdana,geneva;  font-size: large; font-weight: bold; color: #6a94bd; text-decoration: underline;"></html>Compétences :<html></p></html>
     
    '.stripslashes($comp).'
     
    <html><br></html>
    <html><br></html>
    <html><br></html>
    <html><br></html>
    <html><br></html>
    <html><br></html>
     
     
    ----
    ----
    <html><br></html>
     
    <html><center></html>
    <html><img src="http://warforum-jdr.com/images/imgfiches/barre3.jpg" /></html>
    <html><p style="font-family: verdana,geneva;  font-size: large; font-weight: bold; color: #6a94bd; text-decoration: underline;"></html>Inventaires et biens du personnage:<html></p></html>
     
     
    |  **Bourse:**  |  '.stripslashes($bourse).' Pistoles || Autres :  |
    <html><br></html>
    |< 50em >|
    ^  Inventaire (Encombrement: '.stripslashes($enc2).' )                          ^^^^^
    |  Icone  |  **'.stripslashes($arma1nom).'**   |  '.stripslashes($arma1stat).'     |  '.stripslashes($arma1autre).'                     |
    |  Icone  |  **'.stripslashes($arma2nom).'**   |  '.stripslashes($arma2stat).'     |  '.stripslashes($arma2autre).'                     |
    |  Icone  |  **'.stripslashes($usu1).'**  |||
    |  Icone  |  **'.stripslashes($usu2).'**  |||
    |  Icone  |  **'.stripslashes($usu3).'**  |||
    |  Icone  |  **'.stripslashes($usu4).'**  |||
    |  Icone  |  **'.stripslashes($usu5).'**  |||
     
     
    <html></center></html>
     
    <html><br></html>
    ===== Parcours =====
     
    ===Quêtes accomplies===
     
    Nom + lien + récompenses obtenues
     
    === Classes acquises ===
     
    === Voie et Classe en cours d\'apprentissage===
     
    **Voie :**
    <html><br></html>
    **Classe actuelle :** '.stripslashes($carriere).'
     
    === Dévotion religieuse ===
     
    ^  Dieu      ^  Points de dévotions disponibles           ^  Points de dévotions dépensés         ^
    |  **'.stripslashes($pdcname1[]).'**    |  '.stripslashes($pdcname2[]).'  |  0  |
     
     
    ==== Autres ====
     
    __**Au MJ: merci de mettre les éventuels points de croyance dans le cadre ci-dessus**__
     
    '.stripslashes($autre).'
    </textarea></form> '; echo 'Fenêtre n°2 avec le code à copier pour votre signature: <form method=\"post\" action=\"\"><textarea name="codesign" rows="5" cols="70" onFocus="select()" readonly="readonly"> '.stripslashes($nomperso).', '.stripslashes($carriere).' Profil: For '.stripslashes($resultfor).' | End '.stripslashes($resultend).' | Hab '.stripslashes($resulthab).' | Cha '.stripslashes($resultchar).' | Int '.stripslashes($resultint).' | Ini '.stripslashes($resultini).' | Att '.stripslashes($resultatt).' | Par '.stripslashes($resultpar).' | PV '.stripslashes($pv).' Lien Fiche personnage: à demander au MJ </textarea></form> NB: ce code correspond au minimum de ce qu\'on vous demande en signature. Libre à vous d\'ajouter d\'autres informations. '; echo' <br/> <a href="http://warforum-jdr.com">Retour au forum</a>'; } ?>
    Pour moi le souci javascript est réglé ...
    La tu te bats avec php
    Il faut bien que l'erreur php soit réglée pour voir si le script fonctionne correctement, si ce n'est pas le cas, le soucis javascript ne serait pas réglé

  2. #42
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 643
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 643
    Points : 66 669
    Points
    66 669
    Billets dans le blog
    1
    Par défaut
    Teste ce code ci ..
    avec le form en get... et regarde l'url dans la barre d'adresse après soumission du form
    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
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Croyances</title>
    <script type='text/javascript'>
    var Flux=new Array();
    var isIE =(document.all)?true:false;
    Array.prototype.ArrayPos=function(quoi){
            var Position=-1;
            for (i=0;this[i];i++){ if (quoi==this[i]){Position=i;}
                                    }
            return Position;
        }
     
    $Close=function(Closing,Dest){
           var FluxPos=Flux.ArrayPos(Closing)
           var FluxLength=Flux.length;
           var SpliceLength=FluxLength-FluxPos+1;
           var AppendLot=Flux.splice(FluxPos+1,SpliceLength);
     
           for(l=0;AppendLot[0];l++){
                            Closing.appendChild(AppendLot.shift())
                                }
           if(Flux.length==1 && arguments.length==1){document.body.appendChild(Flux.pop())}
           if(Flux.length==1 && arguments.length==2){arguments[1].appendChild(Flux.pop())}
     
                        }
     
     
    var $C= function (HasH){
        var Elt='';
        var Special=false;
     
        switch(HasH['type']){
                case('radio' ): Elt=(isIE)?'<input name="'+HasH['name']+'">':HasH['obj'];
                                  Special=(isIE)?true:false;    
                                  break;
     
                case('checkbox' ): Elt=(isIE)?'<input name="'+HasH['name']+'">':HasH['obj'];
                                  Special=(isIE)?true:false;    
                                  break;
                            case('file' ): Elt=(isIE)?'<input name="'+HasH['name']+'">':HasH['obj'];
                                  Special=(isIE)?true:false;    
                                  break;                             
     
                default:          Elt=HasH['obj'];
                                  Special=(isIE)?true:false;
                }
     
        if(HasH['obj']=='label'){Elt=(isIE)?'<label for="'+HasH['htmlFor']+'">':HasH['obj'];
                                 Special=(isIE)?true:false;
                                 }
      if(HasH['obj']=='select'){Elt=(isIE)?('<select name="'+HasH['name']+'" '+((HasH['multiple']==1)?'multiple ':'')+' >'):HasH['obj'];
                                 Special=(isIE)?true:false;
                                 }
       if(HasH['obj']=='form'){Elt=(isIE)?('<form name="'+HasH['name']+' >'):HasH['obj'];
                                 Special=(isIE)?true:false;
                                 }
     
        var Obj=document.createElement(Elt);
        for (elt in HasH){
            if (elt != 'obj'){
                    if(elt=='css'){   for(Styl in HasH['css']){Obj.style[Styl]=HasH['css'][Styl];}
                                  }
     
                    else{ 
                               if(isIE){ if(!Special || (elt!='name' && elt!='for' )){
                                                                          Obj[elt]=HasH[elt];
                                                                  }
                                  }            
                         else{ Obj[elt]=HasH[elt];
                                }         
     
                    }    
            }
         }
     Flux.push(Obj);    
     return Obj; 
     }
    function Construct(){
        var monfieldset=document.getElementById('Croyances')
        var pdc1=$C({"obj":"input","type":"text","name":"pdcname1[]","size":"15","maxlenght":"255","value":"Nom Dieu","onclick":function(){this.value='';}} );
    	 $Close(pdc1,monfieldset);
    	 var pdc2=$C({"obj":"input","type":"text","name":"pdcname2[]","size":"3","maxlenght":"2"} );
        $Close(pdc2,monfieldset); 
     
    }
    </script>
     
    </head>
     
    <body>
    <form action='#' method='get'>
             <fieldset id='Croyances'>
                <legend>Croyances</legend>
                <input type='button' value='Ajouter un Dieu' onclick='Construct()' /><br />
             </fieldset>
    		  <input type="submit" value="valider" />
    </form>
    </body>
    La partie javascript est don solutionnée CQFD...

  3. #43
    Nouveau membre du Club
    Profil pro
    Étudiant
    Inscrit en
    Avril 2010
    Messages
    127
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2010
    Messages : 127
    Points : 36
    Points
    36
    Par défaut
    Bonsoir

    En effet, je vois ^^

    Bon et bien je vais me diriger vers la section PHP alors

    Merci de votre aide et bonne continuation

    Cordialement

  4. #44
    Nouveau membre du Club
    Profil pro
    Étudiant
    Inscrit en
    Avril 2010
    Messages
    127
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2010
    Messages : 127
    Points : 36
    Points
    36
    Par défaut
    Bonsoir

    Je reviens à la charge ^^

    Je souhaite utiliser le script une seconde fois, sur la même page mais à un endroit différent de la première fois.

    Seulement, quand j'appuie sur le bouton ajouter du 2e générateur dynamique, ca ajoute bien des champs, mais dans le fieldset du 1er générateur dynamique.

    Voyez:


    Le code des 2 scripts:

    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
    <!-- Ajout dynamique de champs PdC-->
    <script src="http://warforum-jdr.com/genprez/champsdynoyau.js">
    </script>
    <script type="text/javascript">
    function Constructpdc(){
        var fieldsetpdc=document.getElementById('Croyances')
     
        var pdc1=$C({"obj":"input","type":"text","name":"pdcname1[]","size":"15","maxlenght":"255","value":"Nom Dieu","onclick":function(){this.value='';}} );
    	$Close(pdc1,fieldsetpdc);
     
    	var pdc2=$C({"obj":"input","type":"text","name":"pdcname2[]","size":"3","maxlenght":"2"} );
        $Close(pdc2,fieldsetpdc); 
     
    	var pdc3=$C({"obj":"br"} );
        $Close(pdc3,fieldsetpdc);
     
    }
     
    </script>
    <!-- Ajout dynamique de champs objets raciaux-->
    <script type="text/javascript">
    function Constructarmes(){
        var fieldsetarma=document.getElementById('Armesarmures')
     
        var arma1=$C({"obj":"input","type":"text","name":"arma1[]","size":"20","maxlenght":"255","value":"Nom arme/armure","onclick":function(){this.value='';}} );
    	 $Close(arma1,fieldsetarma);
     
    	var arma2=$C({"obj":"input","type":"text","name":"arma2[]","size":"20","maxlenght":"255","value":"Caractéristiques","onclick":function(){this.value='';}} );
    	 $Close(arma2,fieldsetarma); 
     
    	var arma3=$C({"obj":"input","type":"text","name":"arma3[]","size":"20","maxlenght":"255","value":"Notes","onclick":function(){this.value='';}} );
    	 $Close(arma3,fieldsetarma);
     
    	var arma4=$C({"obj":"br"} );
        $Close(arma4fieldsetarma);
     
    }
    Et de son utilisation:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    <fieldset id=\'Armesarmures\'>
                <legend>Armes et armures:</legend>
                <input type=\'button\' value=\'Ajouter un objet\' onclick=\'Constructarmes()\' /><br />
             </fieldset>
    Je n'ai pas modifié la librairie. Est-ce à cause de ça ?
    Merci d'avance

  5. #45
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 643
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 643
    Points : 66 669
    Points
    66 669
    Billets dans le blog
    1
    Par défaut
    si tu remarques bien le second argument de Close est la destination de l'append ...

  6. #46
    Nouveau membre du Club
    Profil pro
    Étudiant
    Inscrit en
    Avril 2010
    Messages
    127
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2010
    Messages : 127
    Points : 36
    Points
    36
    Par défaut
    Oui je vois le:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $Close=function(Closing,Dest){
    dans la librairie où dest est donc fieldsetarma, alors pourquoi est-ce rajouté à fieldsetpdc ?

  7. #47
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 643
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 643
    Points : 66 669
    Points
    66 669
    Billets dans le blog
    1
    Par défaut
    le close appende au dernier element de l'array
    array qui se construit dans l'ordre des elements ajoutés
    il ne faut mettre le second paramètre que sur le tout dernier element de l'array pour lui dire ou l'appender dans le document sinon par defaut il l'appende dasn le body ...

  8. #48
    Nouveau membre du Club
    Profil pro
    Étudiant
    Inscrit en
    Avril 2010
    Messages
    127
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2010
    Messages : 127
    Points : 36
    Points
    36
    Par défaut
    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
    <!-- Ajout dynamique de champs PdC-->
    <script src="http://warforum-jdr.com/genprez/champsdynoyau.js">
    </script>
    <script type="text/javascript">
    function Constructpdc(){
        var fieldsetpdc=document.getElementById('Croyances')
     
        var pdc1=$C({"obj":"input","type":"text","name":"pdcname1[]","size":"15","maxlenght":"255","value":"Nom Dieu","onclick":function(){this.value='';}} );
    	$Close(pdc1);
     
    	var pdc2=$C({"obj":"input","type":"text","name":"pdcname2[]","size":"3","maxlenght":"2"} );
        $Close(pdc2); 
     
    	var pdc3=$C({"obj":"br"} );
        $Close(pdc3,fieldsetpdc);
     
    }
     
    </script>
    <!-- Ajout dynamique de champs objets raciaux-->
    <script type="text/javascript">
    function Constructarmes(){
        var fieldsetarma=document.getElementById('Armesarmures')
     
        var arma1=$C({"obj":"input","type":"text","name":"arma1[]","size":"20","maxlenght":"255","value":"Nom arme/armure","onclick":function(){this.value='';}} );
    	 $Close(arma1);
     
    	var arma2=$C({"obj":"input","type":"text","name":"arma2[]","size":"20","maxlenght":"255","value":"Caractéristiques","onclick":function(){this.value='';}} );
    	 $Close(arma2); 
     
    	var arma3=$C({"obj":"input","type":"text","name":"arma3[]","size":"20","maxlenght":"255","value":"Notes","onclick":function(){this.value='';}} );
    	 $Close(arma3);
     
    	var arma4=$C({"obj":"br"} );
         $Close(arma4,fieldsetarma);
     
    }
     
    </script>
    Comme ceci ?

  9. #49
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 643
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 643
    Points : 66 669
    Points
    66 669
    Billets dans le blog
    1
    Par défaut
    Deux fonctions pourquoi faire ? Tu te compliques vraiment la vie !
    Pourquoi ne pas passer à Construct la destination:
    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
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Croyances</title>
    <script type='text/javascript'>
    var Flux=new Array();
    var isIE =(document.all)?true:false;
    Array.prototype.ArrayPos=function(quoi){
            var Position=-1;
            for (i=0;this[i];i++){ if (quoi==this[i]){Position=i;}
                                    }
            return Position;
        }
     
    $Close=function(Closing,Dest){
           var FluxPos=Flux.ArrayPos(Closing)
           var FluxLength=Flux.length;
           var SpliceLength=FluxLength-FluxPos+1;
           var AppendLot=Flux.splice(FluxPos+1,SpliceLength);
     
           for(l=0;AppendLot[0];l++){
                            Closing.appendChild(AppendLot.shift())
                                }
           if(Flux.length==1 && arguments.length==1){document.body.appendChild(Flux.pop())}
           if(Flux.length==1 && arguments.length==2){arguments[1].appendChild(Flux.pop())}
     
                        }
     
     
    var $C= function (HasH){
        var Elt='';
        var Special=false;
     
        switch(HasH['type']){
                case('radio' ): Elt=(isIE)?'<input name="'+HasH['name']+'">':HasH['obj'];
                                  Special=(isIE)?true:false;    
                                  break;
     
                case('checkbox' ): Elt=(isIE)?'<input name="'+HasH['name']+'">':HasH['obj'];
                                  Special=(isIE)?true:false;    
                                  break;
                            case('file' ): Elt=(isIE)?'<input name="'+HasH['name']+'">':HasH['obj'];
                                  Special=(isIE)?true:false;    
                                  break;                             
     
                default:          Elt=HasH['obj'];
                                  Special=(isIE)?true:false;
                }
     
        if(HasH['obj']=='label'){Elt=(isIE)?'<label for="'+HasH['htmlFor']+'">':HasH['obj'];
                                 Special=(isIE)?true:false;
                                 }
      if(HasH['obj']=='select'){Elt=(isIE)?('<select name="'+HasH['name']+'" '+((HasH['multiple']==1)?'multiple ':'')+' >'):HasH['obj'];
                                 Special=(isIE)?true:false;
                                 }
       if(HasH['obj']=='form'){Elt=(isIE)?('<form name="'+HasH['name']+' >'):HasH['obj'];
                                 Special=(isIE)?true:false;
                                 }
     
        var Obj=document.createElement(Elt);
        for (elt in HasH){
            if (elt != 'obj'){
                    if(elt=='css'){   for(Styl in HasH['css']){Obj.style[Styl]=HasH['css'][Styl];}
                                  }
     
                    else{ 
                               if(isIE){ if(!Special || (elt!='name' && elt!='for' )){
                                                                          Obj[elt]=HasH[elt];
                                                                  }
                                  }            
                         else{ Obj[elt]=HasH[elt];
                                }         
     
                    }    
            }
         }
     Flux.push(Obj);    
     return Obj; 
     }
    function Construct(where){
        var monfieldset=document.getElementById(where);
        var pdc1=$C({"obj":"input","type":"text","name":"pdcname1[]","size":"15","maxlenght":"255","value":"Nom Dieu","onclick":function(){this.value='';}} );
    	 $Close(pdc1,monfieldset);
    	 var pdc2=$C({"obj":"input","type":"text","name":"pdcname2[]","size":"3","maxlenght":"2"} );
        $Close(pdc2,monfieldset); 
     
    }
    </script>
     
    </head>
     
    <body>
    <form action='#' method='get'>
             <fieldset id='Croyances'>
                <legend>Croyances</legend>
                <input type='button' value='Ajouter un Dieu' onclick="Construct('Croyances')" /><br />
             </fieldset>
             <fieldset id='Autre'>
                <legend>Autre</legend>
                <input type='button' value='Ajouter Autre' onclick="Construct('Autre')" /><br />
             </fieldset>
     
    		  <input type="submit" value="valider" />
    </form>
    </body>

  10. #50
    Nouveau membre du Club
    Profil pro
    Étudiant
    Inscrit en
    Avril 2010
    Messages
    127
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2010
    Messages : 127
    Points : 36
    Points
    36
    Par défaut
    D'accord, comme ca ca marche mais les champs générés ne sont pas sensés être identiques niveau caractéristiques

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    <script src="http://warforum-jdr.com/genprez/champsdynoyau.js">
    </script>
    <script type="text/javascript">
    function Construct(where){
        var monfieldset=document.getElementById(where);
        var pdc1=$C({"obj":"input","type":"text","name":"pdcname1[]","size":"15","maxlenght":"255","value":"Nom Dieu","onclick":function(){this.value='';}} );
    	 $Close(pdc1,monfieldset);
    	 var pdc2=$C({"obj":"input","type":"text","name":"pdcname2[]","size":"3","maxlenght":"2"} );
        $Close(pdc2,monfieldset); 
     
    }
     
    </script>
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    <fieldset id=\'Armesarmures\'>
                <legend>Armes et armures:</legend>
                <input type=\'button\' value=\'Ajouter un objet\' onclick="Construct(\'Armesarmures\')" /><br />
             </fieldset>
     
    	<fieldset id=\'objusu\'>
                <legend>Objets usuels:</legend>
                <input type=\'button\' value=\'Ajouter un objet\' onclick="Construct(\'objusu\')" /><br />
             </fieldset>
    <fieldset id=\'Croyances\'>
                <legend>Croyance religieuse (<a href="http://warforum-jdr.com/wiki-v2/doku.php?id=3.7_regles_concernant_les_croyances" target=_blank>Points de croyances</a>):</legend>
                <input type=\'button\' value=\'Ajouter un Dieu\' onclick="Construct(\'Croyances\')" /><br />
             </fieldset>
    La page:
    ici

    Là tout les champs ajoutés ont la même structure, quel que soit l'endroit où ils sont utilisés. Hors ce n'est pas ce que je voudrai :s

  11. #51
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 643
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 643
    Points : 66 669
    Points
    66 669
    Billets dans le blog
    1
    Par défaut
    passe le ou les json à la fonction construct ...

  12. #52
    Nouveau membre du Club
    Profil pro
    Étudiant
    Inscrit en
    Avril 2010
    Messages
    127
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2010
    Messages : 127
    Points : 36
    Points
    36
    Par défaut
    Citation Envoyé par SpaceFrog Voir le message
    passe le ou les json à la fonction construct ...
    Pardon ?

  13. #53
    Expert éminent sénior

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    13 474
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Secteur : Finance

    Informations forums :
    Inscription : Janvier 2007
    Messages : 13 474
    Points : 36 571
    Points
    36 571
    Par défaut
    Bonjour,
    Citation Envoyé par Medenor Voir le message
    Pardon ?
    le ou les json = tes variables pdc1 et/ou pdc2

    Leur contenu est au format JSon

    A+

  14. #54
    Nouveau membre du Club
    Profil pro
    Étudiant
    Inscrit en
    Avril 2010
    Messages
    127
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2010
    Messages : 127
    Points : 36
    Points
    36
    Par défaut
    D'accord mais je ne comprends pas ce qu'il faut faire avec ces variables malgré tout :s

  15. #55
    Expert éminent sénior

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    13 474
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Secteur : Finance

    Informations forums :
    Inscription : Janvier 2007
    Messages : 13 474
    Points : 36 571
    Points
    36 571
    Par défaut
    Citation Envoyé par Medenor Voir le message
    D'accord mais je ne comprends pas ce qu'il faut faire avec ces variables malgré tout :s
    Visiblement, les passer en paramètre (en plus de "where") à la fonction
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    function Construct(where, nouveau_param1, nouveau_param2){ ...
    Mais n'ayant pas suivi le reste, je laisse SpaceFrog continuer

    A+

  16. #56
    Nouveau membre du Club
    Profil pro
    Étudiant
    Inscrit en
    Avril 2010
    Messages
    127
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2010
    Messages : 127
    Points : 36
    Points
    36
    Par défaut
    Ok, j'espère un exemple représentatif, parce que là c'est flou pour moi ^^ Là je comprends: il va falloir faire plusieurs exemplaires du script en changeant les paramètres de construct, ca m'étonnerait que ce soit ça

  17. #57
    Expert éminent sénior

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    13 474
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Secteur : Finance

    Informations forums :
    Inscription : Janvier 2007
    Messages : 13 474
    Points : 36 571
    Points
    36 571
    Par défaut
    Citation Envoyé par Medenor Voir le message
    il va falloir faire plusieurs exemplaires du script
    Ben non : si tu les passes en paramètre, a priori, c'est pour pouvoir utiliser le même script, en le rendant paramétrable

    A+

  18. #58
    Nouveau membre du Club
    Profil pro
    Étudiant
    Inscrit en
    Avril 2010
    Messages
    127
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2010
    Messages : 127
    Points : 36
    Points
    36
    Par défaut
    Et concrètement, je rend le script modulable comment par exemple ?

  19. #59
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 643
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 643
    Points : 66 669
    Points
    66 669
    Billets dans le blog
    1
    Par défaut
    le script fonctionne chronologiquement ...

    dans le construct tu mets les objets dans l'ordre parent enfant
    lorsque tu fermes le parent tous les enfant créés avant la fermeture sont appendés au parent ... c'est pourtant clairement expliqué dans le post de la contribution ...
    J'ai rajouté pour le dernier element la destination

    il suffirait donc de modifier la focntion construct pour qu'en lui passant une liste d'arguments elle fasse le travaille dans l'ordre

    par exemple:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    construct(where, {obj1},{obj2},{obj3})

  20. #60
    Nouveau membre du Club
    Profil pro
    Étudiant
    Inscrit en
    Avril 2010
    Messages
    127
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2010
    Messages : 127
    Points : 36
    Points
    36
    Par défaut
    Pourriez-vous me montrer un exemple concret du construct avec 2 obj ? Merci

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

Discussions similaires

  1. Réponses: 9
    Dernier message: 27/07/2016, 14h56
  2. [AC-2007] Ajouter un nouveau champ a un formulaire ou requete
    Par zippi dans le forum IHM
    Réponses: 4
    Dernier message: 02/05/2011, 16h21
  3. Ajout d'un champ par programmation
    Par zwina2004 dans le forum WinDev
    Réponses: 3
    Dernier message: 06/10/2008, 09h17
  4. Réponses: 6
    Dernier message: 10/04/2007, 23h50
  5. Réponses: 4
    Dernier message: 11/05/2006, 16h23

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