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 52 53 54 55 56 57 58 59 60 61
| <script>
var D;
D=0
var value,test;
test=1;
var options
var text, value
value=""
text=""
function plus()
{
D=D+1
document.getElementById('tab2').innerHTML += "<option value="+D+">Chien <br/></option> "
}
function recup(selectId) {
//On récupère le text, et l'id de l'élément selectionné.
var selectElmt = document.getElementById(selectId);
text=selectElmt.options[selectElmt.selectedIndex].text;
return value=selectElmt.options[selectElmt.selectedIndex].value;
}
function del (id) {
var selectValue = recup(id);
//Supression de l'élément qu'on à déplacé dans sa liste
options = document.getElementById (id).options;
var i = 0;
while (options[i].value != selectValue )
i++;
options[i].parentNode.removeChild (options[i]);
}
function depose(id){
a=text
b=value
alert(id)
document.getElementById(id).innerHTML += "<option value="+b+">"+a+"<br/></option> "
}
function choix(id){
recup(id)
if(test=1){
alert(id)
del(id)
test=0
}
else
{
depose(id)
test=1
}
}
</script> |