samedi 31 mai 2014

Retrieve listbox item back from database?


Vote count:

0




How to retrieve listbox item(s) back from database to listBoxT?


My javascript code.....................................................................................................................................



function multiAdd(){
var from = document.getElementById('listBoxF'),
to = document.getElementById('listBoxT');
for(var i = from.length - 1; i >= 0; i--){
if(from.options[i].selected){
to.add(from.options[i]);
from.remove(i);
}
}
multiHidden();
}
function multiAddAll(){
var from = document.getElementById('listBoxF'),
to = document.getElementById('listBoxT');
for(var i = from.length - 1; i >= 0; i--){
to.add(from.options[i]);
from.remove(i);
}
multiHidden();
}
function multiRemove(){
var from = document.getElementById('listBoxT'),
to = document.getElementById('listBoxF');
for (var i = from.length - 1; i >= 0; i--){
if(from.options[i].selected){
to.add(from.options[i]);
from.remove(i);
}
}
multiHidden();
}
function multiRemoveAll(){
var from = document.getElementById('listBoxT'),
to = document.getElementById('listBoxF');
for(var i = from.length - 1; i >= 0; i--){
to.add(from.options[i]);
from.remove(i);
}
multiHidden();
}
function multiHidden(){
var from = document.getElementById('listBoxT'),
to = document.getElementById('listBoxH');
to.value = new Array();
for(var i = from.length - 1; i >= 0; i--){
to.value += from.options[i].value + '|';
}
}

</script>


My Html Code



<form action="" method="POST">
<input type="hidden" name="listBoxH" id="listBoxH">

<select multiple size="8" name="listBoxF" id="listBoxF" style="width:350px">
<option value="Afghanistan"></option>
<option value="Aland Islands"></option>
<option value="Albania">Albania</option>
<option value="Algeria">Algeria</option>
<option value="American Samoa">American Samoa</option>
<option value="Andorra">Andorra</option>
</select>
<div style="text-align:center">
<input type="button" id="listBoxAdd" onclick="multiAdd()" value="Add">
<input type="button" id="listBoxAddAll" onclick="multiAddAll()" value="Add All">
<input type="button" id="listBoxRemove" onclick="multiRemove()" value="Remove">
<input type="button" id="listBoxRemoveAll" onclick="multiRemoveAll()" value="Remove All">
</div>
<select multiple size="8" name="listBoxT" id="listBoxT" style="width:350px"></select>

<input type="submit" name="submit" value="Submit">


asked 57 secs ago






Aucun commentaire:

Enregistrer un commentaire