我在jsp页面中使用JS函数,它在IE9中工作正常。它在IE11中不起作用。
在jsp中:
<button onClick="moveSelectedOptions(this.form['availableUseCases'],this.form['groupUseCases'],true)"></button>
并且js中的函数如下:
function moveSelectedOptions(from,to) {
// Move them over
for (var i=0; i<from.options.length; i++) {
var o = from.options[i];
if (o.selected) {
to.options[to.options.length] = new Option( o.text, o.value, false, false);
}
}
// Delete them from original
for (var i=(from.options.length-1); i>=0; i--) {
var o = from.options[i];
if (o.selected) {
from.options[i] = null;
}
}
if ((arguments.length<3) || (arguments[2]==true)) {
sortSelect(from);
sortSelect(to);
}
from.selectedIndex = -1;
to.selectedIndex = -1;
}