急急急,struts select 多选问题 <select...mutiple="true"><html:option collection="bean" ...>问,如何取得多选框内所选择的序号?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用jquery的插件有个插件像chinahr那样搜索功能的多选那么html的多选没用过有那种把左边的选到右边的没用过 js控制,取options[i].selected=true得值。下面函数取得所有已选得值,并用,分开返回。如果要text,就把.value改成.text。我都这么做,不知道有没有更简单得方法。function getSelectedValue(selectList){ var value=""; for (var i=0; i < selectList.length; i++){ if( selectList.options[i].selected){ value += selectList.options[i].value+","; } } return value;} 这个是把from选择的移动到to的: 即->function moveSelect(from,to){ var s; for (var i=0; i <=from.length - 1; i++){ s = from.options[i]; if(s.selected){ to.add(document.createElement("OPTION")); to.options[to.length-1].text = s.text; to.options[to.length-1].value = s.value; } } for (var i=from.length - 1; i >-1; i--){ s = from.options[i]; if(s.selected){ from.options.remove(i); } } return true;}这个是把所有from的移到to的,即=>function moveAll(from,to){ var s; for (var i=0; i <=from.length - 1; i++){ s = from.options[i]; to.add(document.createElement("OPTION")); to.options[to.length-1].text = s.text; to.options[to.length-1].value = s.value; } for (var i=from.length - 1; i >-1; i--){ from.options.remove(i); } return true;} 有没有什么属性值能够获得index,js试过,但是不太想用 这个是左边一个table表,右边是一个多选框,table表中每一行开头是一个checkbox,有两个按钮“添加”和“删除”,点添加,把左侧table表中check的数据放到多选框中,点“删除”,要把多选框中选中的数据从多选框中删除。有没有这样的例子啊,,,,, select 中有个属性能够控制多选的你查查文档 我以前用过 参考下这个http://penghuaiyi.javaeye.com/blog/391713 MyEclipse出错误啦!不知道怎么搞的啊!sos 怎么利用struts调用word并对它进行各种操作,急!!! 动态 actionForm 问题!在线等。。。。。 关于工作流引擎的问题! 100 请教: 用JAVA 如何实现对 DB2 CLOB 的插入,修改,查询操作? 急...急...急...非常火急... weblogic7中数据源的配置问题(sql server2000) 请问在java中怎样连接Ms Sql Server? JB里面怎么设置getter和setter方法? 递归 GBK 和 UTF-8它们的区别 jqueryui 的dialog遮罩的问题
有个插件像chinahr那样搜索功能的多选
那么html的多选没用过
有那种把左边的选到右边的没用过
下面函数取得所有已选得值,并用,分开返回。如果要text,就把.value改成.text。
我都这么做,不知道有没有更简单得方法。function getSelectedValue(selectList){
var value="";
for (var i=0; i < selectList.length; i++){
if( selectList.options[i].selected){
value += selectList.options[i].value+",";
}
}
return value;
}
function moveSelect(from,to){
var s;
for (var i=0; i <=from.length - 1; i++){
s = from.options[i];
if(s.selected){
to.add(document.createElement("OPTION"));
to.options[to.length-1].text = s.text;
to.options[to.length-1].value = s.value;
}
}
for (var i=from.length - 1; i >-1; i--){
s = from.options[i];
if(s.selected){
from.options.remove(i);
}
}
return true;
}这个是把所有from的移到to的,即=>function moveAll(from,to){
var s;
for (var i=0; i <=from.length - 1; i++){
s = from.options[i];
to.add(document.createElement("OPTION"));
to.options[to.length-1].text = s.text;
to.options[to.length-1].value = s.value;
}
for (var i=from.length - 1; i >-1; i--){
from.options.remove(i);
}
return true;
}
你查查文档 我以前用过
http://penghuaiyi.javaeye.com/blog/391713