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

  FORUM HardWare.fr
  Programmation
  HTML/CSS

  Comment faire marcher ca avec IE

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Comment faire marcher ca avec IE

n°1552507
174flo
Posté le 02-05-2007 à 17:35:32  profilanswer
 

Alors, j'ai ecrit une fontion en javascript, qui doit me permetre d'aficher un menu quand on clique sur un bouton:

Code :
  1. function getInputsByClass(Hclass)
  2. {
  3.  var elements = document.getElementsByTagName("input" );
  4.  var retour = new Array();
  5.  var i;
  6.  var j = 0;
  7.  for(i = 0;i < elements.length;i++)
  8.  {
  9.   var recherche = " " + elements[i].className + " ";
  10.   if(recherche.indexOf(" " + Hclass + " " ) != -1)
  11.    retour[j++] = elements[i];
  12.  }
  13.  return retour;
  14. }
  15. function menu(id,nom,credit)
  16. {
  17.  var boutons = getInputsByClass('mod');
  18.  for(el in boutons)
  19.   boutons[el].type = 'hidden';
  20.  var zone = document.getElementById('courant');
  21.  zone.style.backgroundColor = "#E2E2E2";
  22.  zone.style.border = "1px solid #BBBBBB";
  23.  zone.style.height = "150px";
  24.  html = "<form >";
  25.  html += '<input type="hidden" value='+ id +' size="8" id="id">';
  26.  html += '<table width="100%" border="0" id="liste" name="LiColabo">';
  27.  html += "<tr>";
  28.  html += '<td  width="25%" height="30"></td>';
  29.  html += '<td  width="25%" height="30"></td>';
  30.  html += '<td  width="25%" height="30"><b>Ajouter</b></td>';
  31.  html += '<td  width="25%" height="30"><b>Retirer</b></td>';
  32.  html += "</tr>";
  33.  html += "<tr>";
  34.  html += '<td  width="25%" height="30">';
  35.  html += "&bull;&nbsp;" + nom;
  36.  html += '</td>';
  37.  html += '<td  width="25%" height="30">';
  38.  html += '<input readonly value='+ credit +' size="8" id="credit">';
  39.  html += '</td>';
  40.  html += '<td  width="25%" height="30">';
  41.  html += '<input hidden size="8" id="ajouter">';
  42.  html += '</td>';
  43.  html += '<td  width="25%" height="30">';
  44.  html += '<input hidden size="8" id="retirer">';
  45.  html += '</td>';
  46.  html += "</tr>";
  47.  html += '<tr>';
  48.  html += '<td  width="25%" height="30"></td>';
  49.  html += '<td  width="25%" height="30"></td>';
  50.  html += '<td  width="25%" height="30"></td>';
  51.  html += '<td  width="40%" height="90"><input type="Submit" value="Modifier" /></td>';
  52.  html += '</tr>';
  53.  html+= "</table>";
  54.  html += "</form>";
  55.  zone.innerHTML = html;
  56. }


 
l'ennuies, c'est que ce truc marche parfaitement bien avec Firefox, mais avec ie, j'ai un message:

Citation :

Message d'erreur: Could not get the type property. This command is not supported.


Et bien entendus, il me dit que l'erreur est ligne 227, alors que ya que 187 ligne dans le fichier (bon  
c ptet que ya pas mal de truc en php dedans  :sarcastic:  
Mais enfin, je comprend pas :sweat: , help!!! :sweat:


Message édité par 174flo le 02-05-2007 à 17:43:18
mood
Publicité
Posté le 02-05-2007 à 17:35:32  profilanswer
 

n°1552605
gatsu35
Blablaté par Harko
Posté le 02-05-2007 à 21:05:26  profilanswer
 

boutons[el].type = 'hidden'; ben ouais sous IE changer le type d'un input n'est pas possible à moins de passer par une helper fonction utilise une technique bien crassou mais c'est la seule solution existante :( :

 
Code :
  1. function setType(node, type) {
  2.         try {
  3.             node.type = type;
  4.         } catch(e) {
  5.             if (node.outerHTML) {
  6.                 node.outerHTML=node.outerHTML.replace(/\btype=\w+\b/,'type="text"');
  7.             }
  8.         }
  9.     }
  10. //et ton  bout de code "boutons[el].type = 'hidden';"  devient :
  11. setType(boutons[el], 'hidden');
 

Bien sur je passerai sur le fait que ton code JS/HTML est vraiment à chier


Message édité par gatsu35 le 02-05-2007 à 21:05:50
n°1552939
174flo
Posté le 03-05-2007 à 09:26:59  profilanswer
 

:hello:  
Merci ca marche :)
Mais pour le code, il aurais fallut quoi pour que ca sois mieu? Parce que la, j'apprends sur le tas et j'ai un peu du mal...  :whistle:


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

  Comment faire marcher ca avec IE

 

Sujets relatifs
VB6 INET refuse de marcher depuis hier soir... ca urge[HTML/JS]Comment faire marcher le popup blocker sous FF?
[JS/DOM] Bug sous IE, l'image se s'affiche pas ! [RESOLU]Problème pour faire marcher "xsl:when"
[CSS] IE n'aime pas mon code...PageControl imbriqués, ca peut marcher ?
Comment faire marcher aspx sous IIS ?Recherche personne ki a fait marcher Pervasive SQL et php sous Linux
Adapter un script pour qu'il puisse marcher dans une framecomment faire marcher un boutton
Plus de sujets relatifs à : Comment faire marcher ca avec IE


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