Posted on 2008-07-04 11:03
G_G 阅读(623)
评论(0) 编辑 收藏 所属分类:
javascript
<
input
type
="hidden"
name
="SMSServices"
value
=""
/>
<
td
>
<
select
size
="5"
name
="from_SMSServices"
>
<%
for
(SMSService stmp : SMSServiceUtils.getAllSMSService()) {
%>
<
option
value
="<%=stmp.getId()%>"
>
<%
=
stmp.getName()
%>
</
option
>
<%
}
%>
</
select
>
</
td
>
<
td
>
<
input
type
="button"
value
='>>'
onclick
="optionSelectedMove(this.form,'from_SMSServices','to_SMSServices');"
/><
br
/>
<
input
type
="button"
value
='<<'
onclick
="optionSelectedMove(this.form,'to_SMSServices','from_SMSServices');"
/>
</
td
>
<
td
>
<
select
size
="5"
name
="to_SMSServices"
>
</
select
>
</
td
>
</
tr
>
<
tr
><
input
type
="button"
value
="提交"
onClick
="addSMSServicesValues('SMSServices','to_SMSServices');this.form.submit();"
/></
tr
>
javascript 方法
function addSMSServicesValues(smsName,selectName){
var obj = document.getElementsByName(smsName)[0];
var selObj = document.getElementsByName(selectName)[0];
obj.value = '';
for(var i=0;i<selObj.options.length;i++) {
obj.value += selObj.options[i].value+';';
}
}
function optionSelectedMove(tform,selfromName,seltoName){
var selfromObj = document.getElementsByName(selfromName)[0];
var seltoObj = document.getElementsByName(seltoName)[0];
var optmp = null ;
for(var i=0;i<selfromObj.options.length;i++) {
if(selfromObj.options[i].selected==true) {
optmp = selfromObj.options[i];
selfromObj.remove(i);
break;
}
}
//var varItem = new Option(objItemText, objItemValue);
seltoObj.options.add(optmp);
}