问个问题,希望大伙留步!~
jsp中实现左边框中的记录选择到右边框,比如oracle 10g操作界面的role管理,应该如何实现,用什么方法比较好?
[解决办法]
<SCRIPT LANGUAGE= "JavaScript ">
function move(tbox1) {
fbox=this.combo_box.list4;
var arrFbox = new Array();
var arrTbox = new Array();
var arrLookup = new Array();
var arrtitle = new Array();
var arrtitle1 = new Array();
var i;
for (i = 0; i < fbox.options.length; i++) {
arrLookup[fbox.options[i].text] = fbox.options[i].value;
arrtitle[i] = fbox.options[i].title;
//alert(arrtitle[i]);
arrTbox[i] = fbox.options[i].text;
}
var fLength = 0;
var tLength = arrTbox.length;
for(i = 0; i < tbox1.options.length; i++) {
arrLookup[tbox1.options[i].text] = tbox1.options[i].value;
//alert(tbox1.options[i].title);
if (tbox1.options[i].selected && tbox1.options[i].value != " ") {
arrTbox[tLength] = tbox1.options[i].text;
arrtitle[tLength] = tbox1.options[i].title;
tLength++;
}
else {
arrFbox[fLength] = tbox1.options[i].text;
arrtitle1[fLength] = tbox1.options[i].title;
fLength++;
}
}
arrFbox.sort();
arrTbox.sort();
arrtitle.sort();
arrtitle1.sort();
fbox.length = 0;
tbox1.length = 0;
var c;
for(c = 0; c < arrFbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrFbox[c]];
no.text = arrFbox[c];
no.title = arrtitle1[c];
tbox1[c] = no;
}
for(c = 0; c < arrTbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrTbox[c]];
no.text = arrTbox[c];
no.title = arrtitle[c];
fbox[c] = no;
}
}
function move1() {
fbox=this.combo_box.list4;
var i;
arrtitle2length = 0;
var arrtitle2 = new Array();
var arrFbox = new Array();
var arrLookup = new Array();
var arrtitle = new Array();
var arrTbox1 = new Array();
var arrLookup1 = new Array();
var arrtitle11 = new Array();
var arrTbox2 = new Array();
var arrLookup2 = new Array();
var arrtitle12 = new Array();
var arrTbox3 = new Array();
var arrLookup3 = new Array();
var arrtitle13 = new Array();
for (i = 0; i < fbox.options.length; i++) {
//alert(fbox.options[i].title);
if (fbox.options[i].selected && fbox.options[i].value != " ") {
arrtitle2[arrtitle2length] = fbox.options[i].title;
arrtitle2length++;
//alert(kkk);
}
}
tbox1=this.combo_box.list1;
tbox2=this.combo_box.list2;
tbox3=this.combo_box.list3;
for (i = 0; i < tbox1.options.length; i++) {
arrLookup1[i] = tbox1.options[i].value;
arrtitle11[i] = tbox1.options[i].title;
arrTbox1[i] = tbox1.options[i].text;
}
for (i = 0; i < tbox2.options.length; i++) {
arrLookup2[i] = tbox2.options[i].value;
arrtitle12[i] = tbox2.options[i].title;
arrTbox2[i] = tbox2.options[i].text;
}
for (i = 0; i < tbox3.options.length; i++) {
arrLookup3[i] = tbox3.options[i].value;
arrtitle13[i] = tbox3.options[i].title;
arrTbox3[i] = tbox3.options[i].text;
}
var fLength = 0;
var tLength1 = arrTbox1.length;
var tLength2 = arrTbox2.length;
var tLength3 = arrTbox3.length;
for(i = 0; i < fbox.options.length; i++) {
if (fbox.options[i].selected && fbox.options[i].value != " ") {
if(fbox.options[i].title== "list1 "){
arrLookup1[tLength1] = fbox.options[i].value;
arrTbox1[tLength1] = fbox.options[i].text;
arrtitle11[tLength1] = fbox.options[i].title;
tLength1++;}
if(fbox.options[i].title== "list2 "){
arrLookup2[tLength2] = fbox.options[i].value;
arrTbox2[tLength2] = fbox.options[i].text;
arrtitle12[tLength2] = fbox.options[i].title;
tLength2++;}
if(fbox.options[i].title== "list3 "){
arrLookup3[tLength3] = fbox.options[i].value;
arrTbox3[tLength3] = fbox.options[i].text;
arrtitle13[tLength3] = fbox.options[i].title;
tLength3++;}
}
else {
arrLookup[fLength] = fbox.options[i].value;
arrFbox[fLength] = fbox.options[i].text;
arrtitle[fLength] = fbox.options[i].title;
fLength++;
}
}
arrFbox.sort();
arrTbox1.sort();
arrTbox2.sort();
arrTbox3.sort();
arrtitle.sort();
arrtitle11.sort();
arrtitle12.sort();
arrtitle13.sort();
fbox.length = 0;
tbox1.length = 0;
var c;
for(c = 0; c < arrFbox.length; c++) {
var no = new Option();
no.value = arrLookup[c];
no.title = arrtitle[c];
no.text = arrFbox[c];
fbox[c] = no;
}
for(c = 0; c < arrTbox1.length; c++) {
var no = new Option();
no.value = arrLookup1[c];
no.title = arrtitle11[c];
no.text = arrTbox1[c];
tbox1[c] = no;
}
for(c = 0; c < arrTbox2.length; c++) {
var no = new Option();
no.value = arrLookup2[c];
no.title = arrtitle12[c];
no.text = arrTbox2[c];
tbox2[c] = no;
}
for(c = 0; c < arrTbox3.length; c++) {
var no = new Option();
no.value = arrLookup3[c];
no.title = arrtitle13[c];
no.text = arrTbox3[c];
tbox3[c] = no;
}
}
</script>
<form name= "combo_box "> <input value= "ddddd " type= "button " title= "list1 " onclick= "alert(combo_box.list1.value.title); ">
<table align= "center ">
<tr> <td>
<select multiple size= "5 " name= "list1 " style= "width:150 " ondblclick= "move(this) ">
<option value= "11 " title= "list1 " onclick= "if(this.focus()){this.blur();alert( '1 ');}else{this.focus();alert( '2 ');} "> 项目11 </option>
<option value= "12 " title= "list1 " onclick= "if(this.focus()){this.blur();alert( '1 ');}else{this.focus();alert( '2 ');} "> 项目12 </option>
<option value= "13 " title= "list1 " onclick= "if(this.focus()){this.blur();alert( '1 ');}else{this.focus();alert( '2 ');} "> 项目13 </option>
<option value= "14 " title= "list1 " onclick= "if(this.focus()){this.blur();alert( '1 ');}else{this.focus();alert( '2 ');} "> 项目14 </option>
<option value= "15 " title= "list1 " onclick= "if(this.focus()){this.blur();alert( '1 ');}else{this.focus();alert( '2 ');} "> 项目15 </option>
</select> <br/>
<select multiple size= "5 " name= "list2 " style= "width:150 " ondblclick= "move(this) ">
<option value= "1 " title= "list2 "> 项目21 </option>
<option value= "2 " title= "list2 "> 项目22 </option>
<option value= "3 " title= "list2 "> 项目23 </option>
<option value= "4 " title= "list2 "> 项目24 </option>
<option value= "5 " title= "list2 "> 项目25 </option>
</select> <br/>
<select multiple size= "5 " name= "list3 " style= "width:150 " ondblclick= "move(this) ">
<option value= "1 " title= "list3 "> 项目31 </option>
<option value= "2 " title= "list3 "> 项目32 </option>
<option value= "3 " title= "list3 "> 项目33 </option>
<option value= "4 " title= "list3 "> 项目34 </option>
<option value= "5 " title= "list3 "> 项目35 </option>
</select>
</td>
<td align= "center " valign= "middle ">
<input type= "button " onClick= "move(combo_box.list3);move(combo_box.list2);move(combo_box.list1); " value= "to ">
<input type= "button " onClick= "move1() " value= "back ">
</td>
<td>
<select multiple size= "15 " name= "list4 " style= "width:150 " ondblclick= "move1() ">
</select>
</td> </tr> </table>
</form>
[解决办法]
还是自己写吧,这个需要用jscript,比较简单。。上面演示的太复杂。。
[解决办法]
。。。。。。。。。。。。。。。
[解决办法]
这个很简单呀,建议楼主看下dom的相关知识
[解决办法]
liaohaiying(大菜) 这个还真不错,呵呵
[解决办法]
向楼上的学习....