我一直使用这段代码来对列表中的项目进行排序,然后将顺序提交回数据库。
但是这段代码在Firefox或Chrome中无法正常工作。它会跳动,然后清除列表的内容。自从2002年以来一直在IE中很好地工作..
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;
}
moveUp
或moveDown
函数... - MartindoSubmit()
的?是从表单提交事件还是从javascript:...
链接? - Gabriele Petrioli