I have a HTML select tag. Depending on the selected item in the listbox I want to write this value in a ordering sheet. The ordering sheet is made of several td: Prod1, Prod2, Prod3 ... It must be simple but I can't see it. How come this code:
var compteur = 0;
function Add_Product() {
var e = document.getElementById("SelectionProduct");
var strProduct = e.options[e.selectedIndex].text;
if (compteur = 0) {
document.getElementById('Prod1').innerHTML = strProduct;
compteur++;
}
}
doesn't execute the line:
document.getElementById('Prod1').innerHTML = strProduct;
But this one, which is of no use for my purpose, does:
var compteur = "0";
function Add_Product() {
var e = document.getElementById("SelectionProduct");
var strProduct = e.options[e.selectedIndex].text;
if (compteur = "0") {
document.getElementById('Prod1').innerHTML = strProduct;
}
}
Thanks.
Aucun commentaire:
Enregistrer un commentaire