Creation de tableau en javascript
feydakin
Messages postés
407
Statut
Membre
-
PhP Messages postés 1774 Statut Membre -
PhP Messages postés 1774 Statut Membre -
bonjour,
je m'y connais pas du tt en js. et j'aimerais automatiser un peu plus mon code html en rajoutant du js.
ce que je voudrai sfaire c'est: créer deux models de ligne de tableau comportant 4 colones chaqu'une.
en code html ca donne çà :
**************
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" width="100%" id="AutoNumber1">
<tr><b>
<td width="2%" style="border-style: none; border-width:0"> </td>
<td width="59%" style="border-style:none; border-width:0"><p style="text-align: left"><font class="abc"> <a name="*">*</a></font></td>
<td width="14%" style="border-style:none; border-width:0"> </td>
<td width="25%" style="border-style:none; border-width:0"> </td>
</b></tr>
<tr><b>
<td width="2%" style="border-style:none; border-width:0"> </td>
<td width="59%" style="border:1px solid #000000; "><p class="****"; style="text-align: left"> ***</td>
<td width="14%" style="border:1px solid #000000; "><p class="****">*</td>
<td width="25%" style="border:1px solid #000000; "><p class="****">*</td>
</b></tr>
</table>
********
alors comment je peux faire (si c possible) pour mettre les lignes dans fichiers .js
j'espère que j'ai été assez claire.
merci pour vos réponses.
je m'y connais pas du tt en js. et j'aimerais automatiser un peu plus mon code html en rajoutant du js.
ce que je voudrai sfaire c'est: créer deux models de ligne de tableau comportant 4 colones chaqu'une.
en code html ca donne çà :
**************
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" width="100%" id="AutoNumber1">
<tr><b>
<td width="2%" style="border-style: none; border-width:0"> </td>
<td width="59%" style="border-style:none; border-width:0"><p style="text-align: left"><font class="abc"> <a name="*">*</a></font></td>
<td width="14%" style="border-style:none; border-width:0"> </td>
<td width="25%" style="border-style:none; border-width:0"> </td>
</b></tr>
<tr><b>
<td width="2%" style="border-style:none; border-width:0"> </td>
<td width="59%" style="border:1px solid #000000; "><p class="****"; style="text-align: left"> ***</td>
<td width="14%" style="border:1px solid #000000; "><p class="****">*</td>
<td width="25%" style="border:1px solid #000000; "><p class="****">*</td>
</b></tr>
</table>
********
alors comment je peux faire (si c possible) pour mettre les lignes dans fichiers .js
j'espère que j'ai été assez claire.
merci pour vos réponses.
A voir également:
- Creation de tableau en javascript
- Tableau word - Guide
- Creation de site web - Guide
- Tableau ascii - Guide
- Trier un tableau excel - Guide
- Creation compte gmail - Guide
4 réponses
Pour insérer une ligne fait comme ceci.
Je suppose que tu as compris que j'utilisais l'objet TABLE pour appeler la fonction. :p
function insRow(objTbl)
// ******************************************************
// Function: Insère une ligne et les cellules dans un tableau
// Return: Le numéro de ligne ajouté
// Author: A'Gain
// Date: 05/08/2002
// ******************************************************
{
var intRows = objTbl.rows.length;
var intCells =objTbl.rows(0).cells.length;
objTbl.insertRow(intRows);
for (x=0;x<intCells;x++)
{
var row = objTbl.rows(intRows);
var cell = row.insertCell(x);
}
return intRows;
}
Je suppose que tu as compris que j'utilisais l'objet TABLE pour appeler la fonction. :p
function insRow(objTbl)
// ******************************************************
// Function: Insère une ligne et les cellules dans un tableau
// Return: Le numéro de ligne ajouté
// Author: A'Gain
// Date: 05/08/2002
// ******************************************************
{
var intRows = objTbl.rows.length;
var intCells =objTbl.rows(0).cells.length;
objTbl.insertRow(intRows);
for (x=0;x<intCells;x++)
{
var row = objTbl.rows(intRows);
var cell = row.insertCell(x);
}
return intRows;
}
A la condition que le navigateur supporte DOM niveau 2 ... (out IE 4.x et NS 4.x par ex)
A ce propos ce site donne un excellent comparatif :
http://www.xs4all.nl/~ppk/js/version5.html
En Anglais mais très bien fait.
@+
Php
[[ The Truth is Out There ]]
A ce propos ce site donne un excellent comparatif :
http://www.xs4all.nl/~ppk/js/version5.html
En Anglais mais très bien fait.
@+
Php
[[ The Truth is Out There ]]