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 :

compatibilité IE et Firefox ?


Sujet :

JavaScript

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Février 2006
    Messages
    314
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 314
    Points : 98
    Points
    98
    Par défaut compatibilité IE et Firefox ?
    bonjour, j'ai un code qui me "semble" correcte mais ne fonctionne pas sous firefox, quelqu'un pourrait me dire d'ou cela vient ?

    le javascript :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    function comparez(){
     
    	typeformat = document.getElementById('formatype').options[formatype.selectedIndex].value;
    	format = format.options[format.selectedIndex].value;
    	qtephotos=document.getElementById('qtephotos').value
    	fdpphoto=document.getElementById('fdpphoto').checked;
    	fdtphoto=document.getElementById('fdtphoto').checked;
    	gratuitphoto=document.getElementById('gratuitphoto').checked;
     
     
    	}
    l'html :
    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
     
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td>Format</td>
     
                    <td>Quantit&eacute;</td>
                    <td>Options</td>
                    <td align="center" valign="middle">&nbsp;</td>
                  </tr>
                  <tr>
                    <td width="47%"><select name="formatype" id="formatype" title="diff&eacute;rent format photos"  onchange="listeformat(this.options[this.selectedIndex].value);">
                        <option value="num" selected="selected">Num&eacute;rique</option>
     
                        <option value="ana" >Argentique</option>
                        <option value="post" >Grands formats</option>
                        <option value="pan" >Panoramique</option>
                      </select>
                                            <div id='divformat' style='display:inline'>
                          <select name="format" id="format" title="forumat de developpement photo">
                            <option value='2'>6 x 8</option><option value='5'>10 x 13</option><option value='7' selected="selected">11 x 15</option><option value='8'>13 x 17</option><option value='11'>15 x 20</option><option value='14'>20 x 27</option><option value='35'>11 x 15  eco</option>                      </select>
     
                        </div>
                    </td>
                    <td width="18%"><input type="text" name="qtephotos" id="qtephotos" size="8" style="text-align:center" value="1" /></td>
                    <td width="25%"><ul>
                        <li>
                          <input name="fdpphoto" id="fdpphoto" type="checkbox" checked="checked" />
                          Frais de port</li>
                      <li>
     
                          <input name="fdtphoto"  id="fdtphoto" type="checkbox"  checked="checked" />
                        Frais de traitement </li>
                      <li>
                          <input name="gratuitphoto" id="gratuitphoto" type="checkbox"  checked="checked"  />
                        Photos gratuites </li>
                    </ul></td>
                    <td width="10%" align="center" valign="middle"><label>
                      <a href="javascript:comparez();">Comparez</a> 
                    </label></td>
     
                  </tr>
                </table>

  2. #2
    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 640
    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 640
    Points : 66 664
    Points
    66 664
    Billets dans le blog
    1
    Par défaut
    déja sous IE ça coince là
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    format = format.options[format.selectedIndex].value;
    c'est quoi format ?

  3. #3
    Membre régulier
    Profil pro
    Inscrit en
    Février 2006
    Messages
    314
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 314
    Points : 98
    Points
    98
    Par défaut
    pardon j'avais fait un test en faite le bon code c'est

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    	format = document.getElementById('format').options[format.selectedIndex].value;
    il s'agit d'une liste box

  4. #4
    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 640
    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 640
    Points : 66 664
    Points
    66 664
    Billets dans le blog
    1
    Par défaut
    heu non je ne pense pas ...

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    document.getElementById('format').options[document.getElementById('format').selectedIndex].value;
    il y a conflit entre le nom des variables et les id !

    change l'uin ou l'autre ..

    format => Format
    par exemple

  5. #5
    Membre régulier
    Profil pro
    Inscrit en
    Février 2006
    Messages
    314
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 314
    Points : 98
    Points
    98
    Par défaut
    bon ca ne donne rien de bon j'ai changé le "name" de tous les champs , mais ca ne fonctionne pas !
    "cette fonction ne gere pas cette propriété"


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    function comparez(){
     
    	typeformat = document.getElementById('formatype').options[formatype1.selectedIndex].value;
    	format = document.getElementById('format').options[format1.selectedIndex].value;
    	qtephotos=document.getElementById('qtephotos').value
    	fdpphoto=document.getElementById('fdpphoto').checked;
    	fdtphoto=document.getElementById('fdtphoto').checked;
    	gratuitphoto=document.getElementById('gratuitphoto').checked;
    }
    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
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td>Format</td>
                    <td>Quantit&eacute;</td>
                    <td>Options</td>
                    <td align="center" valign="middle">&nbsp;</td>
                  </tr>
                  <tr>
                    <td width="47%"><select name="formatype1" id="formatype" title="diff&eacute;rent format photos"  onchange="listeformat(this.options[this.selectedIndex].value);">
                        <option value="num" selected="selected">Num&eacute;rique</option>
                        <option value="ana" >Argentique</option>
                        <option value="post" >Grands formats</option>
                        <option value="pan" >Panoramique</option>
                      </select>
                                            <div id='divformat' style='display:inline'>
                          <select name="format1" id="format" title="forumat de developpement photo">
                            <option value='2'>6 x 8</option><option value='5'>10 x 13</option><option value='7' selected="selected">11 x 15</option><option value='8'>13 x 17</option><option value='11'>15 x 20</option><option value='14'>20 x 27</option><option value='35'>11 x 15  eco</option>                      </select>
                        </div>
                    </td>
                    <td width="18%"><input type="text" name="qtephotos1" id="qtephotos" size="8" style="text-align:center" value="1" /></td>
                    <td width="25%"><ul>
                        <li>
                          <input name="fdpphoto1" id="fdpphoto" type="checkbox" checked="checked" />
                          Frais de port</li>
                      <li>
                          <input name="fdtphoto1"  id="fdtphoto" type="checkbox"  checked="checked" />
                        Frais de traitement </li>
                      <li>
                          <input name="gratuitphoto1" id="gratuitphoto" type="checkbox"  checked="checked"  />
                        Photos gratuites </li>
                    </ul></td>
                    <td width="10%" align="center" valign="middle"><label>
                      <a href="javascript:comparez();">Comparez</a> 
                    </label></td>
                  </tr>
                </table>

  6. #6
    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 640
    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 640
    Points : 66 664
    Points
    66 664
    Billets dans le blog
    1
    Par défaut
    fallait pas changer le name des champs mais le nom des variables ...

    c'est pas très cohérant tout ça ...

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    format = document.getElementById('format').options[format1.selectedIndex]

  7. #7
    Membre régulier
    Profil pro
    Inscrit en
    Février 2006
    Messages
    314
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 314
    Points : 98
    Points
    98
    Par défaut
    ha ok pardon je comprends tout un peu de travers ....

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    	typeformat1 = document.getElementById('formatype').options[formatype.selectedIndex].value;
    	format1 = document.getElementById('format').options[format.selectedIndex].value;
    	qtephotos1=document.getElementById('qtephotos').value
    	fdpphoto1=document.getElementById('fdpphoto').checked;
    	fdtphoto1=document.getElementById('fdtphoto').checked;
    	gratuitphoto1=document.getElementById('gratuitphoto').checked;
    	alert(fdtphoto1);
    toujours le meme probleme, fonctionne sous Internet explorer mais pas sur Firefox ...

    A voir ici :

    http://r12586.ovh.net/~developp/inde...ge=comparateur

    j'affiche l'état de fdtphoto1 (true par défaut)

  8. #8
    Rédacteur

    Avatar de Bovino
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juin 2008
    Messages
    23 647
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2008
    Messages : 23 647
    Points : 91 220
    Points
    91 220
    Billets dans le blog
    20
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    typeformat1 = document.getElementById('formatype').options[document.getElementById('formatype').selectedIndex].value;
    	format1 = document.getElementById('format').options[document.getElementById('format').selectedIndex].value;

  9. #9
    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 640
    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 640
    Points : 66 664
    Points
    66 664
    Billets dans le blog
    1
    Par défaut
    en gros ..; ce que j'ai mis plus haut

  10. #10
    Rédacteur

    Avatar de Bovino
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juin 2008
    Messages
    23 647
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2008
    Messages : 23 647
    Points : 91 220
    Points
    91 220
    Billets dans le blog
    20
    Par défaut
    Oui, comme souvent , mais il parait que la répétition crée la notion !

  11. #11
    Membre régulier
    Profil pro
    Inscrit en
    Février 2006
    Messages
    314
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 314
    Points : 98
    Points
    98
    Par défaut
    ha ben oui c'est ca mon soucis pourtant j'avais testé !! mais je crois que je m'étais embrouillé !!

    bref merci bien les gens!

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

Discussions similaires

  1. compatibilité Javascript IE | Firefox
    Par 20cents dans le forum Général JavaScript
    Réponses: 4
    Dernier message: 13/06/2009, 11h55
  2. [DOM] Compatibilité Javascript et Firefox
    Par Madness64 dans le forum Général JavaScript
    Réponses: 7
    Dernier message: 01/01/2009, 17h39
  3. compatibilité IE et FireFox
    Par lion13 dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 27/08/2007, 14h56
  4. Compatibilité IE6, IE7, Firefox 2
    Par maxfive7 dans le forum Balisage (X)HTML et validation W3C
    Réponses: 2
    Dernier message: 05/08/2007, 23h26

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