急急急!!!高分求助!!!java 中实现 左右选择菜单添加、删除、排序。 注意: 不用下拉框实现。

左边是默认菜单:
父菜单1
(checkbox)子菜单1
(checkbox)子菜单2
(checkbox)子菜单3
右边是选中后的子菜单,父菜单不用添加过来。checkbox要选中才能添加

只有下拉菜单的例子:
<div id="wrapBody" class="wrap_body" style="width: 100%px;height:421px;*height:424px;">
<div style="padding: 30px;height:429px;text-align:center;" id="login">
<table width="80%">
<td valign="top" align="left" width="30%" colspan="2">
<div style="text-align:center; display:inline">         
        <font size="2"><s:text name="country.choice.wait"/></font></div><br />
         

<select multiple="multiple" size="20" id="unSelectedCountry" style="width:240px!important;height:300px!important;">
<option value="0">交易</option>
<option value="1">交易明细</option>
<option value="2">风险挡掉交易</option>
<option value="3">重复订单号交易</option>
<option value="4">冻结拒付交易</option>
</select>
</td>
<td valign="middle" width="20%" colspan="2"> <br />
<table border="0">
<tr>
<td height="25" align="center"><input type="button"
name="submit1" value="--->[添加]" class="button" id="choiceBtn"
onClick="choiceCountry('unSelectedCountry','range','1');" /></td>
</tr>
<tr>
<td height="25" align="center"><input type="button"
name="submit22" value="<---[移除]" class="button" id="exitbackBtn"
onClick="choiceCountry('range','unSelectedCountry','1');" /></td>
</tr>
<tr>
<td height="25" align="center"><input type="button"
name="submit4" value="<==[全部移除]" class="button" id="allexitBtn"
onClick="choiceCountry('range','unSelectedCountry','0');" /></td>
</tr>
</table>
</td>
<td valign="top" width="30%" colspan="2">
<div style="text-align:center; display:inline">
        <font size="2"><s:text name='country.choice.choice'/></font></div>
<br />
    <select theme="simple" id="range" size="20"
style="width: 240px!important;height:300px!important;" multiple="true" name="range">
</select></td>
</table>
</div>
</div>

<script type="text/javascript">

function choiceCountry(srcSelect, objSelect, type) {
srcSelect = document.getElementById(srcSelect);
objSelect = document.getElementById(objSelect);
if (type == "0") {
var length = srcSelect.options.length - 1;
for ( var i = length; i >= 0; i--) {
var varItem = new Option(srcSelect.options[i].text,
srcSelect.options[i].value);
objSelect.options.add(varItem);
srcSelect.options[i] = null;
}
} else {
var length = srcSelect.options.length - 1;
var changelength = length;
if(length == -1)
return
for ( var i = length; i >= 0; i--) {
if (srcSelect[i].selected == true) {
var varItem = new Option(srcSelect.options[i].text,
srcSelect.options[i].value);
objSelect.options.add(varItem);
srcSelect.options[i] = null;
changelength = length - 1;
}
}
if (changelength == length) {
var varItem = new Option(srcSelect.options[0].text,
srcSelect.options[0].value);
objSelect.options.add(varItem);
srcSelect.options[0] = null;
}
}
</script>
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-05-28
可以用树结构
第2个回答  2012-05-29
能不能找个有这功能的例子,有点不明白你想要什么效果.
相似回答