I have always used this code to sort items in a list then submit the order back intot the database.
But the code doesn't work in Firefox, or Chrome. It jumps and then clears out the contents of the list. It's been used since 2002 works very fine in IE only..
var list;
function moveUp() {
list = document.forms[0].lists;
var index = list.selectedIndex;
if (index > 0) {
var item = list.options[index];
list.remove(index);
list.add(item, index - 1);
}
}
function moveDown() {
list = document.forms[0].lists;
var index = list.selectedIndex;
if (index > -1 && index < list.options.length - 1) {
var item = list.options[index];
list.remove(index);
list.add(item, index + 1);
}
}
function doSubmit() {
var s = "";
list = document.forms[0].lists;
for (var i = 0; i < list.options.length; i++) {
s += list.options[i].value + " ";
}
document.forms[0].order.value = s;
return false;
}