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
| <script>
function create_prod(i) {
var i2 = i + 1;
var elmt = document.getElementById('pr');
document.getElementById('prod_'+i).InnerHTML = '<select name="prod"><br><br>';
for(var j=0; j< elmt.options.length; j++){if(elmt.options[j].selected == true){
document.getElementById('prod_'+i).InnerHTML += '<option value="prod" id="prod"'+j'">'+elmt.options[j].value;+'</option>';
}
}
document.getElementById('prod_'+i).InnerHTML += '</select>';
document.getElementById('prod_'+i).innerHTML += (i <= 10) ? '<br /><span id="prod_'+i2+'"><a href="javascript:create_prod('+i2+')"><img src="images/add.png" alt="" /></a></span>' : '';
}
</script>
<form method="post" action="ajouter_commande.php">
Article: <select name="prod" id="pr"><br><br>
<option value="gomme rose" id="prod" name="informations_prod">gomme rose - Prix : 0.25$ - 905 produits encore disponibles"</option>
<option value="crayon HB par 10" id="prod" name="informations_prod">crayon HB par 10 - Prix : 0.50$ - 2980 produits encore disponibles"</option>
<option value="calepin 50 p. gd format" id="prod" name="informations_prod">calepin 50 p. gd format - Prix : 0.35$ - 1425 produits encore disponibles"</option>
<option value="calculette poche" id="prod" name="informations_prod">calculette poche - Prix : 2.00$ - 800 produits encore disponibles"</option>
<option value="bloc notes 100 p" id="prod" name="informations_prod">bloc notes 100 p - Prix : 0.70$ - 1000 produits encore disponibles"</option>
<option value="bloc notes 200 p" id="prod" name="informations_prod">bloc notes 200 p - Prix : 1.20$ - 980 produits encore disponibles"</option>
<option value="calcul. Financière" id="prod" name="informations_prod">calcul. Financière - Prix : 3.50$ - 490 produits encore disponibles"</option>
<option value="gomme bleue dure" id="prod" name="informations_prod">gomme bleue dure - Prix : 0.20$ - 900 produits encore disponibles"</option>
<option value="stylo bille bleu par 3" id="prod" name="informations_prod">stylo bille bleu par 3 - Prix : 0.30$ - 1000 produits encore disponibles"</option>
</select>
Quantité: <input type="text" name="qte" alt="quantite"/>
<span id="prod_1"><a href="javascript:create_prod(1)"><img src="images/add.png" alt="" /></a></span>
<center><input type="submit" value="envoyer"/><input type="reset" value="effacer"/></center>
</form> |
J'ai modifié un petit peu mais ça ne marche toujours, en fait mon gros probléme et que j'utilise WAPP Stack que je ne connais pas du tout, Bon là la console d'erreur m'indique qu'il me manque une virgule dans cette ligne de code:
document.getElementById('prod_'+i).InnerHTML += '<option value="prod" id="prod"'+j'">'+elmt.options[j].value;+'</option>';
Partager