Hello,
oui, c'est possible.
Je te copie un extrait d'une fonction que j'ai codé pour un projet :
Bon en fait, je te copie toute la fonction, c'est plus simple que de la découper lol :
function displayChoice (art_id, sk_id, sk_lib) {
div = document.getElementById('affChoixEmp['+art_id+']');
if (check = document.getElementById('empId['+art_id+']['+sk_id+']')) {
return false;
} else {
var cont = document.getElementById('cont_quantite['+art_id+']');
nbCont = parseInt (cont.value);
nbCont ++;
cont.value = nbCont;
emp = document.createElement ('div');
empId = div.appendChild (emp);
empId.id = 'empId['+art_id+']['+sk_id+']';
bt = document.createElement ('img');
bouton = empId.appendChild (bt);
bouton.src='img/pic.close.gif';
bouton.title='Supprimer';
bouton.alt='Supprimer';
bouton.style.cursor='pointer';
bouton.id='img['+art_id+']['+sk_id+']';
d = document.getElementById('img['+art_id+']['+sk_id+']');
d.onclick = function () {div.removeChild(document.getElementById('empId['+art_id+']['+sk_id+']'));checkChoice (art_id, sk_id); nbCont --; cont.value = nbCont;};
lib = document.createTextNode (' '+sk_lib+' ');
empId.appendChild (lib);
inp = document.createElement ('input');
input = empId.appendChild (inp);
input.type='text';
input.name='sk_art_quantite['+art_id+']['+sk_id+']';
input.id='sk_art_quantite['+art_id+']['+sk_id+']';
valeur = document.getElementById('sk_art_quantite['+art_id+']['+sk_id+']');
valeur.value= '0';
valeur.onblur = function () {checkChoice (art_id, sk_id)};
checkChoice (art_id, sk_id);
}
}