两个 下拉列表框 Select 的 Option 互相移动
来源:互联网 发布:mac 4k显示器字体太小 编辑:程序博客网 时间:2024/06/08 18:54
<html>
<head>
</head>
<script type="text/javascript">
function show(){
Str = "";
Ss = document.getElementById("Select_id");
//alert(Ss.length);
//alert( Ss.selectedIndex );
Str += "/t"+"Obj.index"+"/t"+"Obj.value"+"/t"+"Obj.text"+"/t"+"Obj.innerText"+"/n";//标题栏
for(i=0;i<Ss.length;i++){
if(Ss[i].selected == true ){
Str += "/t"+Ss[i].index+"/t"+Ss[i].value+"/t"+Ss[i].text+"/t"+Ss[i].innerText+"/n";
}
}
alert(Str);
//ItemsSelect.options[ItemsSelect.selectedIndex].value;
//ItemsSelect.options[ItemsSelect.selectedIndex].id;
//ItemsSelect.value;
//ItemsSelect.options[ItemsSelect.selectedIndex].text;
}
function Add(){
/*Add*/
Ss = document.getElementById("Select_id");
Ss2 = document.getElementById("Select2_id");
// clear
len2 = Ss2.length;
for(i=0;i<len2;i++){
if(Ss2[i].selected == true){
Ss2[i].selected = false;
}
}
// move
len = Ss.length;//alert(len);
for(i=0;i<len;i++){
if(Ss[i].selected == true){
//Ss2.appendChild(Ss[i]);
Ss2.insertBefore(Ss[i],Ss2.firstChild);
len -= 1;
i -= 1;
}
}
//alert(len);
}
function Del(){
/*Del*/
Ss = document.getElementById("Select_id");
Ss2 = document.getElementById("Select2_id");
// clear
len = Ss.length;
for(i=0;i<len;i++){
if(Ss[i].selected == true){
Ss[i].selected = false;
}
}
// move
len2 = Ss2.length;//alert(len2);
for(i=0;i<len2;i++){
if(Ss2[i].selected == true){
//Ss.appendChild(Ss[i]);
Ss.insertBefore(Ss2[i],Ss.firstChild);
len2 -= 1;
i -= 1;
}
}
//alert(len2);
}
</script>
<body>
<table>
<tr><td>
A.<br>
<select id="Select_id" multiple="multiple" size="6" style="width: 106px; overflow: auto;" >
<option value= "0">0000000000</option>
<option value= "1">1111111111</option>
<option value= "2" title="2222222222222">2222222222222</option>
<option value= "3">3333333333</option>
<option title="000000000option value000000055" value= "4">444444444444444option value44444444444444</option>
<option value= "5">55555555</option>
<option value= "6">6666666666666</option>
<option value= "7">7777</option>
<option value= "8">8888888888</option>
<option value= "9">999999999</option>
<option value= "10">10 10 10</option>
<option value= "11">11 11 11</option>
<option value= "123">12 12 12</option>
</select>
</td><td>
<input type="button" value="Btn_show" onclick="show()" ><br>
<input type="button" value="Add >>" onclick="Add()" ><br>
<input type="button" value="<< Del" onclick="Del()" ><br>
</td><td>
B.<br>
<select id="Select2_id" multiple="multiple" size="6" style="width: 106px; overflow: auto;" >
<option value= "13">13 13 13</option>
</select>
</td>
</tr>
</body>
</html>
- 两个 下拉列表框 Select 的 Option 互相移动
- 用js实现两个select下拉框之间的元素互相移动
- 用js实现两个select下拉框之间的元素互相移动
- Select下拉列表框(添加、删除option)
- Select下拉列表框(添加、删除option)
- 下拉列表 select-option ; select-optgroup-option
- html 两个多选下拉列表元素互相移动
- 两个select之间option的互相添加操作(jquery实现)
- jQuery 两个select之间option的互相添加操作
- 【JavaScript】列表元素上下左右移动:Select和Option的应用
- HTML中的下拉列表:<select>、<option>、<optgroup>。
- jQuery实现两个下拉菜单的选项互相移动效果
- 下拉列表select动态添加option和获取选中的option的值和value
- jQuery插件DIY:设置左右select的option的互相移动
- 两个select列表相互移动
- 有关两个select内容互相移动问题
- javascript两个select控件内容互相移动
- select下拉框value和option的取值顺序
- Cache Management in ASP.NET
- js分割取某字符在字符串中的个数
- sprintf函数详细解释
- 辞职
- 使用ATL的W2A和A2W宏
- 两个 下拉列表框 Select 的 Option 互相移动
- linux面试题参考答案(转)
- [转]Beware of Hot Skills Lists: a JonERP.com Disclaimer and Tips List
- Office宏 PowerPoint提取文字到Word - -
- 我的第一次博客生涯
- c语言画图函数
- Ajax与WCF交互-WCF之美
- 安装Firefox查看源码软件Firebug
- 101条伟大的计算机编程名言