Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
780 connectés 

  FORUM HardWare.fr
  Programmation
  HTML/CSS

  [Résolu] Problème getElementById IE8 et safari

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[Résolu] Problème getElementById IE8 et safari

n°1991887
finaldinas​ty
Posté le 10-05-2010 à 16:47:18  profilanswer
 

Bonjour,
 
J'ai un problème avec un scripte tout simple. Ce bout de code permet, en cliquant sur un élément d'un menu déroulant, d'afficher une div et de cacher les autres.
 
Ca fonctionne sous Firefox, Opéra
Ca ne fonctionne pas sous IE8, Safari
 
Pourquoi ?
 

Code :
  1. <form name="Choix">
  2.      Ville :&nbsp;<select name="Liste" style="width:150px;" onChange="Lien()">
  3.       <option selected onClick="document.getElementById('blmap1').style.display='none';
  4.            document.getElementById('blmap2').style.display='none';
  5.            document.getElementById('blmap3').style.display='none';">Choisir une ville</option>
  6.       <option onClick="document.getElementById('blmap1').style.display='block';
  7.            document.getElementById('blmap2').style.display='none';
  8.            document.getElementById('blmap3').style.display='none';">Carte 1</option>
  9.       <option onClick="document.getElementById('blmap1').style.display='none';
  10.            document.getElementById('blmap2').style.display='block';
  11.            document.getElementById('blmap3').style.display='none';">Carte 2</option>
  12.       <option onClick="document.getElementById('blmap1').style.display='none';
  13.            document.getElementById('blmap2').style.display='none';
  14.            document.getElementById('blmap3').style.display='block';">Carte 3</option>
  15.      </select>
  16.     </form>
  17. <div id="blmap1" style="display:none;">CONTENU blmap1</div>
  18. <div id="blmap2" style="display:none;">CONTENU blmap2</div>
  19. <div id="blmap3" style="display:none;">CONTENU blmap3</div>


Message édité par finaldinasty le 11-05-2010 à 09:57:08
mood
Publicité
Posté le 10-05-2010 à 16:47:18  profilanswer
 

n°1991958
David Bori​ng
Posté le 10-05-2010 à 19:34:31  profilanswer
 

C'est le comportement normal de ces deux moteurs.
Tu dois récupérer (par exemple) l'index de l'option choisie en passant par le select. Pour être plus clair, voilà un exemple
http://www.w3schools.com/js/tryit. [...] tion_index

n°1992048
finaldinas​ty
Posté le 11-05-2010 à 09:56:47  profilanswer
 

Merci beaucoup ca fonctionne parfaitement :)
 
Bonne journée!


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  HTML/CSS

  [Résolu] Problème getElementById IE8 et safari

 

Sujets relatifs
Problème sur une macro Excel(resolu) Interview Analyste Programmeur
[RESOLU] Mes liens ne fonctionnent plusProblème à inséré du JQUERY
Problème retour arrière avec STDIN[Résolu] Connexion à une BDD en local ET à distance
[Résolu] bash - grep et expressions régulières[js] problème avec jquery
Plus de sujets relatifs à : [Résolu] Problème getElementById IE8 et safari


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR