移动项目在双列表框 [英] Moving items in Dual Listboxes
本文介绍了移动项目在双列表框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我怎样才能摆脱一个列表框控件的项目在ASP.NET中使用JavaScript另一个列表框控件?
How can I move items from one list box control to another listbox control using JavaScript in ASP.NET?
推荐答案
这code假设你有一个锚或点击它时,将触发迁徙:
This code assumes that you have an anchor or that will trigger to movement when it is clicked:
document.getElementById('moveTrigger').onclick = function() {
var listTwo = document.getElementById('secondList');
var options = document.getElementById('firstList').getElementsByTagName('option');
while(options.length != 0) {
listTwo.appendChild(options[0]);
}
}
这篇关于移动项目在双列表框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文