J'y suis presque, sauf qu'il veut pas me coller la nouvelle portion au niveau de la balise <div id="tartempion"></div>
Ca marche, mais ça fait un peu bordélique.
Voici à quoi ressemble mon code pour vous faire une idée:
<html>
<head>
<title>titre</title>
<script>
function addArticle(idChamp) {
try {
var conteneur = document.getElementById(idChamp);
var undiv = document.createElement('div');
var untr = document.createElement('tr');
var untd = document.createElement('td');
var desc = document.createTextNode('Description :');
var inpdesc = document.createElement('input');
var detail = document.createTextNode('Detail :');
var inpdetail = document.createElement('input');
var pu = document.createTextNode('Prix unitaire :');
var inppu = document.createElement('input');
var quantite = document.createTextNode('Quantité :');
var inpquantite = document.createElement('input');
var remise = document.createTextNode('remise :');
var inpremise = document.createElement('input');
var euro = document.createTextNode('€');
var pourcent = document.createTextNode('%');
inpdesc.setAttribute('type', 'text');
inpdesc.setAttribute('name','desc[]');
inpdesc.setAttribute('value','');
inpdesc.setAttribute('maxlenght', '200');
inpdesc.setAttribute('size', '51');
inpdetail.setAttribute('type', 'textarea');
inpdetail.setAttribute('name', 'detail[]');
inpdetail.setAttribute('cols', '50');
inpdetail.setAttribute('rows', '5');
inppu.setAttribute('type', 'text');
inppu.setAttribute('name', 'pu[]');
inppu.setAttribute('value', '0');
inppu.setAttribute('maxlenght', '5');
inppu.setAttribute('size', '4');
inpquantite.setAttribute('type', 'text');
inpquantite.setAttribute('name', 'quantite[]');
inpquantite.setAttribute('value', '0');
inpquantite.setAttribute('maxlenght', '3');
inpquantite.setAttribute('size', '2');
inpremise.setAttribute('type', 'text');
inpremise.setAttribute('name', 'remise_art[]');
inpremise.setAttribute('value', '0');
inpremise.setAttribute('maxlenght', '2');
inpremise.setAttribute('size', '2');
undiv.appendChild(untr);
undiv.appendChild(untd);
undiv.appendChild(desc);
undiv.appendChild(untd);
undiv.appendChild(inpdesc);
undiv.appendChild(untr);
undiv.appendChild(untd);
undiv.appendChild(detail);
undiv.appendChild(untd);
undiv.appendChild(inpdetail);
undiv.appendChild(untr);
undiv.appendChild(untd);
undiv.appendChild(pu);
undiv.appendChild(untd);
undiv.appendChild(inppu);
undiv.appendChild(euro);
undiv.appendChild(untr);
undiv.appendChild(untd);
undiv.appendChild(quantite);
undiv.appendChild(untd);
undiv.appendChild(inpquantite);
undiv.appendChild(untr);
undiv.appendChild(untd);
undiv.appendChild(remise);
undiv.appendChild(untd);
undiv.appendChild(inpremise);
undiv.appendChild(pourcent);
conteneur.appendChild(undiv);
}
catch(e) {
alert(e);
}
}
</script>
</head>
<body>
<div id="contenu">
<form action="index.php" method="POST">
<table border="1" cellspacing="6">
<tr>
<td>Client :</td>
<td><select name="client">
<option value="toto">toto</option>
<option value="titi">titi</option>
<option value="tata">tata</option>
</select>
</td>
</tr>
<tr>
<td></td>
<td align="right"><a href="#" onClick="javascript:addArticle('divarticle');"><img src="images/add.png" alt="add" />Ajouter un article</a></td>
<tr>
<td>Description :</td>
<td><input type="text" name="desc[]" maxlenght="200" size="51" /></td>
</tr>
<td valign="top">Detail :</td>
<td><textarea name="detail[]" cols="50" rows="5" /></textarea></td>
</tr>
<tr>
<td>Prix unitaire :</td>
<td><input type="text" name="pu[]" value="0" maxlenght="5" size="4" />€</td>
</tr>
<tr>
<td>Quantité :</td>
<td><input type="text" name="quantite[]" value="0" maxlenght="3" size="2" /></td>
</tr>
<tr>
<td>Remise :</td>
<td><input type="text" name="remise_art[]" value="0" maxlenght="2" size="2" />%</td>
</tr>
<div id="divarticle"></div>
</table>
<br />
<input type="submit" value="<?php echo _OK ?>" />
</form>
</body>
</html>
J'ai testé sous Mac et Windows, avec FF, Safari et IE7, j'ai toujours le même résultat
