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 :

getElementById et IE7


Sujet :

JavaScript

  1. #1
    Membre averti
    Inscrit en
    Janvier 2007
    Messages
    13
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 13
    Par défaut getElementById et IE7
    Bonjour a tous ...

    J'ai un petit souci d'incompatibilité entre Mozilla et IE7 avec getElementById

    J'explique mon cas. sur une page PHP, j'ai créé un formulaire dynamique un peu à la manière d'excel pour la saisie de chiffres d'un bilan que l'on peut considéré comme comptable. Il y a donc plusieurs ligne et parfois plusieurs colonnes. pour chaque colonne j'ai des lignes à saisir et des sous-totaux calculés automatiquement par une fonction javascript. A la fin du document, j'ai un total qui est calculé en faisant la somme des sous totaux.

    Pour différencier dans mon formulaire (créé en PHP) j'ai mis un ID à chaque sous-total. De cette manière j'appelle les sous totaux pas le getElementById et les autres par getElementsByName.

    Mon imcompatibilité entre IE et firefox, est que mon total ne prend pas en compte les sous-totaux, mais tous les champs :

    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
    var i=0;
    	var j=0;
    	var total=0;
    	var m=0;
    	while(i != nbgroup) //tant que j'ai pas atteins le nombre de sous-totaux passés en paramètres
    	{
                if(document.getElementById(nomd+j)) //je regarde si c un sous-total
    	    {
    		alert(nomd+j); //affichage du champ qui devrait etre un sous total
    		if(i<nbgroup-1) // je ne prend pas en compte mon dernier Id qui est le champ total
    		{
    		     if(document.getElementById(nomd+j).value!="") //vérification si la valeur n'est pas vide 
    		     {
    			total = total + parseInt(document.getElementById(nomd+j).value); // somme des sous-totaux
    		     }
    		}
    		m=j; // enregistrement de la position du dernier ID (donc mon champ total)
    		i = i+1;
    	    }
    	    j = j+1;
    	}
    	alert(nomd+m);
    	document.getElementById(nomd+m).value=total; //affectation de mon total
    Lorsque je fais mon premier alert sous FF, je bien le champ correspondant à l'id que j'ai saisi, mon sous-total est correct, et mon total également. Sous IE, il affiche bien le premier sous-total (qui est le premier champ de mon formulaire), puis ensuite ne se préoccupe plus des id et m'affiche les champs qui ne comportent pas d'id, ce qui fausse mon sous-total, et surtout qui m'affiche mon total dans un autre champ que celui désiré ...

    Quelqu'un aurait-il une idée ???

  2. #2
    Expert éminent

    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
    Par défaut
    Bonjour,
    peux-tu donner la partie html correspondante ?
    Pas d'erreur apparente dans le JS, mais certaines références aux objets sont peut être erronées / ambigües ...

    A+

  3. #3
    Membre averti
    Inscrit en
    Janvier 2007
    Messages
    13
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 13
    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
    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
    <form action="groupe_RT_CA.php" method="post" onsubmit="SaisieNOk()" name="RT_CA">
    <table align="center" width="940px" border="0" style="margin:10px 20px 10px 20px;">
    	<?php
            $CA = new RT_ChiffreAffaires(0);
            $colonnes = $CA->getColonnes();
            $group = $CA->getAllGroup();
            $nbGroup = count($group);
            $col=count($colonnes);
            $taille=940;
            if($col>1) //Si plusieurs colonnes
            {
                    if(($col*200)<400) //calcul auto de la taille des colonnes
                    {
                            $taille_libelle=400;
                            $taille_champ=floor(($taille-$taille_libelle)/$col);
                    }
                    else
                    {
                            $taille_champ=200;
                            $taille_libelle=floor($taille-($col*200));
                    }
                    echo '<tr>';
                    echo '<td align="left" width="'.$taille_libelle.'px">&nbsp;</td>';
                    echo '<tr>';
                    for ($i=0; $i<$colonne; $i++)
                    {
                            echo '<td width="'.$taille_champ.'px" align="center">'.$colonnes[$i]['RT_col_CA_libelle'].'</td>';
                    }       
                    echo '</tr>';
                    echo '<tr><td colspan="'.($col+1).'">&nbsp;</td></tr>';
            }
            else
            {
                    $taille_champ=200;
                    $taille_libelle=740;
            }
            foreach ($group as $group_) //pour chaque group / Sous-total
            {
                    echo '<tr>';
                    echo '<td width="'.$taille_libelle.'px" align="left"><b>'.$group_['RT_CA_id'].' - '.utf8_encode($group_['RT_CA_libelle']).'</b></td>';
                    if ($group_['RT_CA_CalculAuto']==1) // group à calcul automatique
                    {
                            for($i=0; $i<$col; $i++)
                            {
                                    $nom = str_replace(" ","_", $colonnes[$i]['RT_col_CA_libelle']);
                                    $nom= strtr($nom, "ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ", "aaaaaaaaaaaaooooooooooooeeeeeeeecciiiiiiiiuuuuuuuuynn"); 
                                    echo '<td width="'.$taille_champ.'" align="center"><input type="text" size="15" name="'.$nom.'_'.$group_['RT_CA_id'].'" id="'.$nom.'_'.$group_['RT_CA_id'].'" value="'.$_POST[$nom.'_'.$group_['RT_CA_id']].'" disabled="disabled" class="GEX"></td>';
                            }       
                            
                            $var = $CA->getAllByGroup($group_['RT_CA_id']);
                            $nb=count($var);
                            $category = $group_['RT_CA_id'];
                            $min = $var[0]['RT_CA_id'];
                            $max = $var[$nb-1]['RT_CA_id']+1;
                    }
                    else
                    {
                            $min=0;
                            $max=0;
                            $category = 0;
                            for($i=0; $i<$col; $i++)
                            {
                                    $nom = str_replace(" ","_", $colonnes[$i]['RT_col_CA_libelle']);
                                    $nom= strtr($nom, "ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ", "aaaaaaaaaaaaooooooooooooeeeeeeeecciiiiiiiiuuuuuuuuynn"); 
                                    echo '<td width="'.$taille_champ.'" align="center"><input type="text" size="15" name="'.$nom.'_'.$group_['RT_CA_id'].'" id="'.$nom.'_'.$group_['RT_CA_id'].'" value="'.$_POST[$nom.'_'.$group_['RT_CA_id']].'" OnKeyUp ="verif(\''.$nom.'_'.$rubrique_['RT_CA_id'].'\', \''.$category.'\',\''.$min.'\', \''.$max.'\', \''.$nbGroup.'\', \''.$nom.'\')"></td>';
                            }                               
                    }
                    echo '<tr>';
                    $rubrique = $CA->getAllByGroup($group_['RT_CA_id']);
                    foreach ($rubrique as $rubrique_) // champs à saisir
                    {
                            echo '<tr>';
                            echo '<td width="740px" align="left">'.$rubrique_['RT_CA_id'].' - '.utf8_encode($rubrique_['RT_CA_libelle']).'</td>';
                            for($i=0; $i<$col; $i++)
                            {
                                    $nom = str_replace(" ","_", $colonnes[$i]['RT_col_CA_libelle']);
                                    $nom= strtr($nom, "ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ", "aaaaaaaaaaaaooooooooooooeeeeeeeecciiiiiiiiuuuuuuuuynn"); 
                                    echo '<td width="'.$taille_champ.'" align="center"><input type="text" size="15" name="'.$nom.'_'.$rubrique_['RT_CA_id'].'" value="'.$_POST[$nom.'_'.$rubrique_['RT_CA_id']].'" OnKeyUp ="verif(\''.$nom.'_'.$rubrique_['RT_CA_id'].'\', \''.$category.'\',\''.$min.'\', \''.$max.'\', \''.$nbGroup.'\', \''.$nom.'\')"></td>';
                            }               
                            echo '</tr>';
                    }
                    echo '<tr><td colspan="2">&nbsp;</td></tr>';            
            }
            if($rubrique_['RT_CA_id']>$group_['RT_CA_id'])
            {
                    $nb_champs=$rubrique_['RT_CA_id'];
            }
            else
            {
                    $nb_champs=$group_['RT_CA_id'];
            }
            echo '<tr><td colspan="2">&nbsp;</td></tr>';
            echo '<tr><td colspan="2" align="center"><input type="submit" name="Valid_RT_CA" value="Continuer" class="Bouton"><input type="hidden" name="nb_champ" value="'.$nb_champs.'"></td></tr>';
    ?>
    </table>
    </form>

  4. #4
    Expert éminent

    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
    Par défaut
    Hum ... HTML, pas PHP.
    Récupère le dans le nav, en faisant "afficher la source de la page" ...

    A+

  5. #5
    Membre averti
    Inscrit en
    Janvier 2007
    Messages
    13
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 13
    Par défaut
    sorry, mal lu ...

    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
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
       <HTML>
    	<HEAD>
    	    <TITLE>toto</TITLE>
    	    <LINK rel="stylesheet" type="text/css" href="style.css">
    	    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    	</HEAD>
                <body>
    	        <div id="main">
    		    <div id="header">
    			<img src="images/logo.gif" alt="Reah Team" align="left">
    		    </div>
    		    <div id="contenu">
     
    <script type="text/javascript">
    function verif(champ, category, rubrique_min, rubrique_max, nbgroup, nom){
     
    	var nomd = nom+'_';
    	//tout d'abord on regarde si la valeur saisie est un chiffre
    	var valeur=document.getElementsByName(champ)[0].value;
    	var nb=9999999999;
    	if (!(valeur=="")){
    		if(isNaN(valeur) == true)
    		{
    			alert(valeur + " n'est pas un nombre, veuillez recommencer!");
    			document.getElementsByName(champ)[0].focus();
    			return false;
    		}	
    	}
     
    	//ensuite, on vérifie que le nombre est inférieur � la valeur entrée dans le xml
    	if (valeur>nb){
    		alert("La valeur maximum est de " + nb + ", veuillez recommencer.");
    		document.getElementsByName(champ)[0].focus();
    		return false;
    	}
     
    	if(parseInt(category)!=0)
    	{
    		var k=0;
    		for(a=rubrique_min; a<rubrique_max; a++)
    		{
    			if(document.getElementsByName(nomd+a)!=null)
    			{
    				if(document.getElementsByName(nomd+a)[0].value!="")
    				{
    					k = k+ parseInt(document.getElementsByName(nomd+a)[0].value);
    				}
    			}
    		}
    		document.getElementById(nomd+category).value=k;
    	}
    	var i=0;
    	var j=0;
    	var total=0;
    	var m=0;
    	while(i != nbgroup)
    	{
    		if(document.getElementById(nomd+j))
    		{
    			alert(nomd+j);
    			if(i<nbgroup-1)
    			{
    				if(document.getElementById(nomd+j).value!="")
    				{
    					total = total + parseInt(document.getElementById(nomd+j).value);
    				}
    			}
    			m=j;
    			i = i+1;
    		}
    		j = j+1;
    	}
    	alert(nomd+m);
    	document.getElementById(nomd+m).value=total;
     
    }
     
    function SaisieNOk()
    {
    	var num = (document.forms["RT_CA"].elements.length)-2;
    	for(a = 0; a < num; a++){	
    		var obj = document.forms["RT_CA"].elements[a];
    		if(document.getElementById(obj.name)!=null)
    		{
    			if(document.getElementById(obj.name).disabled==true)
    			{
    				document.getElementById(obj.name).disabled=false;
    			}
    		}
    	}
    }
    </script>
     
     
    <form action="groupe_RT_CA.php" method="post" onsubmit="SaisieNOk()" name="RT_CA">
    <table align="center" width="940px" border="0" style="margin:10px 20px 10px 20px;">
     
    	<tr>
                <td width="740px" align="left"><b>10 - Marchandises "Handicap"</b></td>
                <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_10" id="Montant_Exercie_10" value="" disabled="disabled" class="GEX"></td>
             </tr>
             <tr>
                  <td width="740px" align="left">11 - Vente HAD / MAD et confort</td>
                  <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_11" value="" OnKeyUp ="verif('Montant_Exercie_11', '10','11', '20', '9', 'Montant_Exercie')"></td>
             </tr>
             <tr>
                   <td width="740px" align="left">12 - Vente Matériel anti-escarres</td>
                   <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_12" value="" OnKeyUp ="verif('Montant_Exercie_12', '10','11', '20', '9', 'Montant_Exercie')"></td>
             </tr> 
              <tr>
                   <td width="740px" align="left">13 - Vente Véhicules pour handicapés</td>
                   <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_13" value="" OnKeyUp ="verif('Montant_Exercie_13', '10','11', '20', '9', 'Montant_Exercie')"></td>
             </tr>
             <tr>
                   <td width="740px" align="left">14 - Vente Aides techniques</td>
                   <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_14" value="" OnKeyUp ="verif('Montant_Exercie_14', '10','11', '20', '9', 'Montant_Exercie')"></td>
              </tr>
              <tr>
                    <td width="740px" align="left">15 - Vente Incontinence</td>
                    <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_15" value="" OnKeyUp ="verif('Montant_Exercie_15', '10','11', '20', '9', 'Montant_Exercie')"></td>
              </tr>
              <tr>
                    <td width="740px" align="left">16 - Vente Respiratoire</td>
                    <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_16" value="" OnKeyUp ="verif('Montant_Exercie_16', '10','11', '20', '9', 'Montant_Exercie')"></td>
              </tr>
              <tr>
                    <td width="740px" align="left">17 - Vente Nutrition</td>
                    <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_17" value="" OnKeyUp ="verif('Montant_Exercie_17', '10','11', '20', '9', 'Montant_Exercie')"></td>
              </tr>
              <tr>
                   <td width="740px" align="left">18 - Vente Perfusion</td>
                   <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_18" value="" OnKeyUp ="verif('Montant_Exercie_18', '10','11', '20', '9', 'Montant_Exercie')"></td>
              </tr>
              <tr>
                   <td width="740px" align="left">19 - Divers</td>
                   <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_19" value="" OnKeyUp ="verif('Montant_Exercie_19', '10','11', '20', '9', 'Montant_Exercie')"></td>
              </tr>
               <tr>
                    <td colspan="2">&nbsp;</td>
              </tr>
              <tr>
                    <td width="740px" align="left"><b>20 - Services "Handicap"</b></td>
                    <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_20" id="Montant_Exercie_20" value="" disabled="disabled" class="GEX"></td>
               </tr>
               <tr>
                    <td width="740px" align="left">21 - SAV Fauteuil Roulant</td>
                    <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_21" value="" OnKeyUp ="verif('Montant_Exercie_21', '20','21', '23', '9', 'Montant_Exercie')"></td>
               </tr>
               <tr>
                     <td width="740px" align="left">22 - SAV Divers</td>
                     <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_22" value="" OnKeyUp ="verif('Montant_Exercie_22', '20','21', '23', '9', 'Montant_Exercie')"></td>
               </tr>
               <tr>
                     <td colspan="2">&nbsp;</td>
               </tr>
                <tr>
                     <td width="740px" align="left"><b>30 - Location</b></td>
                     <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_30" id="Montant_Exercie_30" value="" disabled="disabled" class="GEX"></td>
               </tr>
               <tr>
                    <td width="740px" align="left">31 - Location HAD / MAD</td>
                    <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_31" value="" OnKeyUp ="verif('Montant_Exercie_31', '30','31', '37', '9', 'Montant_Exercie')"></td>
               </tr>
               <tr>
                     <td width="740px" align="left">32 - Location Fauteuil Roulant</td>
                     <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_32" value="" OnKeyUp ="verif('Montant_Exercie_32', '30','31', '37', '9', 'Montant_Exercie')"></td>
                </tr>
                <tr> 
                      <td width="740px" align="left">33 - Location Respiratoire</td>
                      <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_33" value="" OnKeyUp ="verif('Montant_Exercie_33', '30','31', '37', '9', 'Montant_Exercie')"></td>
                </tr>
                <tr>
                      <td width="740px" align="left">34 - Location Nutrition</td>
                      <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_34" value="" OnKeyUp ="verif('Montant_Exercie_34', '30','31', '37', '9', 'Montant_Exercie')"></td>
                </tr>
                <tr>
                      <td width="740px" align="left">35 - Location Perfusion</td>
                      <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_35" value="" OnKeyUp ="verif('Montant_Exercie_35', '30','31', '37', '9', 'Montant_Exercie')"></td>
                </tr>
                <tr>
                      <td width="740px" align="left">36 - Location Divers</td>
                      <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_36" value="" OnKeyUp ="verif('Montant_Exercie_36', '30','31', '37', '9', 'Montant_Exercie')"></td>
                </tr>
                <tr>
                      <td colspan="2">&nbsp;</td>
                </tr>
                <tr>
                      <td width="740px" align="left"><b>40 - Marchandises "Professionnels"</b></td>
                      <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_40" id="Montant_Exercie_40" value="" disabled="disabled" class="GEX"></td>
                </tr>
                <tr>
                     <td width="740px" align="left">41 - Vente Mobilier médical</td>
                     <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_41" value="" OnKeyUp ="verif('Montant_Exercie_41', '40','41', '49', '9', 'Montant_Exercie')"></td>
                </tr>
                <tr>
                      <td width="740px" align="left">42 - Vente Eclairage</td>
                      <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_42" value="" OnKeyUp ="verif('Montant_Exercie_42', '40','41', '49', '9', 'Montant_Exercie')"></td>
                 </tr>
                 <tr>
                       <td width="740px" align="left">43 - Vente Diagnostic</td>
                       <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_43" value="" OnKeyUp ="verif('Montant_Exercie_43', '40','41', '49', '9', 'Montant_Exercie')"></td>
                  </tr>
                  <tr>
                        <td width="740px" align="left">44 - Vente Mesures et contrôles</td>
                        <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_44" value="" OnKeyUp ="verif('Montant_Exercie_44', '40','41', '49', '9', 'Montant_Exercie')"></td>
                   </tr>
                   <tr>
                         <td width="740px" align="left">45 - Vente Instrumentation - Maroquinerie médicale</td>
                        <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_45" value="" OnKeyUp ="verif('Montant_Exercie_45', '40','41', '49', '9', 'Montant_Exercie')"></td>
                    </tr>
                    <tr>
                          <td width="740px" align="left">46 - Vente Consommables</td>
                          <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_46" value="" OnKeyUp ="verif('Montant_Exercie_46', '40','41', '49', '9', 'Montant_Exercie')"></td>
                    </tr>
                    <tr>
                          <td width="740px" align="left">47 - Vente Stérilisation - Désinfection</td>
                          <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_47" value="" OnKeyUp ="verif('Montant_Exercie_47', '40','41', '49', '9', 'Montant_Exercie')"></td>
                     </tr>
                     <tr>
                           <td width="740px" align="left">48 - Divers</td>
                           <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_48" value="" OnKeyUp ="verif('Montant_Exercie_48', '40','41', '49', '9', 'Montant_Exercie')"></td>
                     </tr>
                     <tr>
                           <td colspan="2">&nbsp;</td>
                     </tr>
                     <tr>
                           <td width="740px" align="left"><b>50 - Services "Professionnels"</b></td>
                           <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_50" id="Montant_Exercie_50" value="" OnKeyUp ="verif('Montant_Exercie_48', '0','0', '0', '9', 'Montant_Exercie')"></td>
                     </tr>
                     <tr>
                           <td colspan="2">&nbsp;</td>
                     </tr>
                     <tr>
                           <td width="740px" align="left"><b>51 - SAV</b></td>
                           <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_51" id="Montant_Exercie_51" value="" OnKeyUp ="verif('Montant_Exercie_48', '0','0', '0', '9', 'Montant_Exercie')"></td>
                     </tr>
                     <tr>
                           <td colspan="2">&nbsp;</td>
                     </tr>
                     <tr>
                           <td width="740px" align="left"><b>52 - Divers</b></td>
                           <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_52" id="Montant_Exercie_52" value="" OnKeyUp ="verif('Montant_Exercie_48', '0','0', '0', '9', 'Montant_Exercie')"></td>
                     </tr>
                     <tr>
                           <td colspan="2">&nbsp;</td>
                     </tr>
                     <tr>
                           <td width="740px" align="left"><b>53 - CA non réparti</b></td>
                           <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_53" id="Montant_Exercie_53" value="" OnKeyUp ="verif('Montant_Exercie_48', '0','0', '0', '9', 'Montant_Exercie')"></td>
                      </tr>
                      <tr>
                            <td colspan="2">&nbsp;</td>
                      </tr>
                      <tr>
                            <td width="740px" align="left"><b>54 - Total : </b></td>
                            <td width="200px" align="center"><input type="text" size="15" name="Montant_Exercie_54" id="Montant_Exercie_54" value="" disabled="disabled" class="GEX"></td>
                       </tr>
                       <tr>
                             <td colspan="2">&nbsp;</td>
                       </tr>
                       <tr>
                             <td colspan="2">&nbsp;</td></tr><tr><td colspan="2" align="center"><input type="submit" name="Valid_RT_CA" value="Continuer" class="Bouton"><input type="hidden" name="nb_champ" value="54"></td>
                       </tr>
                  </table>
             </form>
       </div>
       <div id="footer">
       </div>
    </div>
    </body>
    </html>

  6. #6
    Expert éminent

    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
    Par défaut
    Le pb pour les champs sans id (Montant_Exercie_31 à 36) est dû à un bug d'IE (je croyais que c'était corrigé dans la 7 ) : il autorise la confision entre name et id (considère les name comme des id).
    Du coup, il faudrait ajouter un autre test permettant d'écarter ceux que tu veux pas ...
    (peut être stocker leur id dans un tableau JS )

    A+

  7. #7
    Membre averti
    Inscrit en
    Janvier 2007
    Messages
    13
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 13
    Par défaut
    je pensais bien que ct encore un bug de notre bon vieux IE () ...

    perso je vois pas comment stocker dans un tableau JS les valeur que je veux pas alors que le seul moyen de différencier les sous-totaux du reste est justement l'introduction d'un ID dans le code... De plus, il me faut un tableau en mémoire, car c'est une fonction appelé régulièrement !

    Cela marcherait-il si le name et l'id étaient différents ??

  8. #8
    Expert éminent

    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
    Par défaut
    Citation Envoyé par Albinpopote
    Cela marcherait-il si le name et l'id étaient différents ??
    Oui, c'est une autre solution

    A+

  9. #9
    Membre averti
    Inscrit en
    Janvier 2007
    Messages
    13
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 13
    Par défaut
    bon et bien voila j'ai différencier le nom et l'id ... Ca fonctionnne parfaitement sur les deux nivagateurs ...

    Encore un grand merci E.Bzz pour tes infos et surtout pour ta rapidité de réponse ...

    Bonne continuation ...

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

Discussions similaires

  1. getElementById marche pour ff mais pas pour IE7
    Par Stessy dans le forum Général JavaScript
    Réponses: 7
    Dernier message: 29/02/2008, 16h32
  2. document.getElementById et IE7
    Par robinou dans le forum Général JavaScript
    Réponses: 5
    Dernier message: 10/07/2007, 17h16
  3. getelementbyid innerhtml sur Opera?
    Par cynthia dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 31/12/2004, 10h44
  4. getElementsByName ou getElementById
    Par lepierre dans le forum Général JavaScript
    Réponses: 3
    Dernier message: 21/10/2004, 15h44

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