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

  FORUM HardWare.fr
  Programmation
  HTML/CSS

  Javascript Compter les tags "td"

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Javascript Compter les tags "td"

n°1755492
Toinou87
That misread could have been.
Posté le 04-07-2008 à 11:05:31  profilanswer
 

Bonjour,
j'ai une table de ce type (bien sur avec d'autres donnees)
 
<table id="test">
<tr>
<td>1</td>  <td>2</td>  <td>3</td>  <td>4</td>  <td>5</td>
</tr>
</table>
 
et je voudrai pouvoir conter le nombre de td dans le tr
j'ai ca
 
test = document.getElementById("test" );
nbColumns = test.firstChild.firstChild.childNodes.length;  
 
ca me revoit 5 sous IE (pour une fois que ca marche sous IE) et plante sous FF
(je vieux bien sur 5)
 
Merci d'avance pour l'aide


---------------
Toinou87 ;-p May the force be with you!!
mood
Publicité
Posté le 04-07-2008 à 11:05:31  profilanswer
 

n°1755496
anapajari
s/travail/glanding on hfr/gs;
Posté le 04-07-2008 à 11:09:51  profilanswer
 

document.getElementById("test" ).rows[0].cells.length()


---------------
Software and cathedrals are much the same - first we build them, then we pray.
n°1755500
Toinou87
That misread could have been.
Posté le 04-07-2008 à 11:14:24  profilanswer
 

je viens de tester ca et ca marche ni pour IE ni pour FF


---------------
Toinou87 ;-p May the force be with you!!
n°1755512
Bidem
Posté le 04-07-2008 à 11:29:55  profilanswer
 

document.getElementById("test" ).rows[0].cells.length
 
(cells donne un tableau)

n°1755515
Toinou87
That misread could have been.
Posté le 04-07-2008 à 11:33:40  profilanswer
 

yes ca marche, merci


---------------
Toinou87 ;-p May the force be with you!!
n°1755517
bul3
Posté le 04-07-2008 à 11:34:33  profilanswer
 


bonjour à toutes et à tous,
 
anapajary++
 
si, si ( l'impératrice ), ça fonctionne parfaitement !
 
<body>
<table id="test">
<tr>
<td>1</td>  <td>2</td>  <td>3</td>  <td>4</td>  <td>5</td>
</tr>
</table>
<script>
 alert( document.getElementById("test" ).rows[0].cells.length );
 </script>
 </body>
 
essaye donc... et n'oublie pas les balises <body> et </body>
on peut bien entendu faire cela "autrement"
 
Cordialement.


---------------
[mon site] [m'écrire]
n°1755550
mIRROR
Chevreuillobolchévik
Posté le 04-07-2008 à 12:17:02  profilanswer
 

length est une propriété pas une methode
anapajari devait etre mal reveillé :D


---------------
« The enemy is the gramophone mind, whether or not one agrees with the record that is being played at the moment. » — George Orwell
n°1755577
anapajari
s/travail/glanding on hfr/gs;
Posté le 04-07-2008 à 13:27:14  profilanswer
 

mIRROR a écrit :

length est une propriété pas une methode
anapajari devait etre mal reveillé :D


lendemain de fête :o


---------------
Software and cathedrals are much the same - first we build them, then we pray.
n°1755629
mIRROR
Chevreuillobolchévik
Posté le 04-07-2008 à 15:19:47  profilanswer
 

ouais ouais des excuses :o


---------------
« The enemy is the gramophone mind, whether or not one agrees with the record that is being played at the moment. » — George Orwell
n°1755807
gatsu35
Blablaté par Harko
Posté le 05-07-2008 à 03:43:13  profilanswer
 

anapajari est une merde intersidérale et pis c'est tout :o

mood
Publicité
Posté le 05-07-2008 à 03:43:13  profilanswer
 

n°1756196
anapajari
s/travail/glanding on hfr/gs;
Posté le 07-07-2008 à 09:47:56  profilanswer
 

gatsu35 a écrit :

anapajari est une merde intersidérale et pis c'est tout :o


un cake [:aloy]
et moi je poste après les soirées, pas pendant :o


---------------
Software and cathedrals are much the same - first we build them, then we pray.

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

  Javascript Compter les tags "td"

 

Sujets relatifs
Activer javascript lors d'une combinaison de touchesProbleme javascript et IE
[JavaScript] Comparer deux tableauxJavascript sous Acrobat
[reglé] access, comment compter ?JavaScript - Meme largeur de colonne pour deux tables
[JavaScript] tri d'un tableau[javascript] modifier contenu d'une balise
appel de deux fonctions javascript dans un onsubmit[ActiveX] Execution de javascript
Plus de sujets relatifs à : Javascript Compter les tags "td"


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