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
| <html>
<form name = "lecteur">
<select name = "choix"
onChange = "Add(document.lecteur.choix.selectedIndex)">
<option>page1
<option>page2
<option>page3
<option>page4
</select>
</form>
<table id="mytable">
<form action="$..." method=POST>
<td>réf.</td><td>quantité</td><td class = "rightrow" rowspan="7"></td></tr>
<tr>
<td rowspan="0"><input name="ref" size="10" value="">
<td><input name="addToCartsubmit" size="4"></td>
</tr>
</table></td><input type="button" value="Ajouter une ligne" onClick="AddRow(1)">
<script type="text/javascript">
function AddRow(nbre_lignes){
var compteur = 0;
while (compteur < nbre_lignes) {
var newRow = document.getElementById('mytable').insertRow(-1);
var newCell = newRow.insertCell(0);
compteur ++;
newCell.innerHTML = '<input name="ref" size="10" value="">';
newCell = newRow.insertCell(1);
newCell.innerHTML = '<input name="addToCartsubmit" size="4">';
newCell = newRow.insertCell(2);
newCell.innerHTML = '<input type="button" value="Supprimer une ligne" onClick="Add(2)">'}
}
function Add(x) {
AddRow(x);
}
</script>
</form>
</html> |