r�cup�rer un tableau html en un tableau js
salut
j'ai essay� de passer un tableau html en php et j'ai trouv� que c impossible pour cela j'essai de le passer en javascript et puis le transf�rer en php mais j'ai pas pu le r�cup�rer en js. toujours c'est la derni�re ligne que je trouve?
le code de la page est le suivant
Code:
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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
<html >
<head>
<title></title>
</head>
<script language=javascript>
tab=new Array();
i=0;
function remplirtab()
{
tab[i,0]=document.fp.pdt.value;
tab[i,1]=document.fp.qte.value;
tab[i,2]=document.fp.pu.value;
i++;
}
function affiche()
{
alert ('taille du tableau'+ tab.length);
for (j=0;j<=tab.length;j++)
{document.write(tab[j,0]);
document.write(tab[j,1]);
document.write(tab[j,2]);
}
}
function ajouter()
{
var newRow = document.getElementById('matable').insertRow(-1);
var newCell = newRow.insertCell(0);
newCell.innerHTML = document.fp.pdt.value;
newCell = newRow.insertCell(1);
newCell.innerHTML = document.fp.qte.value;
newCell = newRow.insertCell(2);
newCell.innerHTML = document.fp.pu.value;
}
</script>
<body>
<form method="POST" name=fp action=''>
<table border="0" width="100%" id="table1">
<tr>
<td rowspan="4">
<input type="button" value="Ajouter" name="aj" onclick="ajouter()"></td>
</tr>
<tr>
<td width="179"><b><font face="Georgia" color="#000080">
Produit</font></b></td>
<td><input type="text" name="pdt" size="20"></td>
</tr>
<tr>
<td width="179"><b><font face="Georgia" color="#000080">
Quantité</font></b></td>
<td><font face="Georgia" color="#FFFFFF">
<input type="text" name="qte" size="20"></font></td>
</tr>
<tr>
<td width="179">
<b><font face="Georgia" color="#000099">Prix </font></b></td>
<td><input type="text" name="pu" size="20"></td>
</tr>
</table>
<p> </p>
<table border="1" width="55%" id="matable">
<tr>
<td width="198"><b>
<font face="BatangChe" color="#000080">Produit</font></b></td>
<td width="105"><font face="BatangChe" color="#000080"><b>
Quantité</b></font></td>
<td><font face="BatangChe" color="#000080"><b>PU</b></font></td>
</tr>
</table>
<p><input type="submit" value="valider" name="valid"><input type="button" value="Afficher" name="B1" onclick=affiche()></p>
</form>
</body>
</html> |
merci de m'avoir aider ou de me donner comment proc�der