首页 > 其他 > 详细

slected多选框的转移

时间:2014-12-04 17:30:53      阅读:332      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
    
</head>
<script language="javascript">
    function change(sel1,sel2){
            var s1=document.getElementById(sel1)
            var s2=document.getElementById(sel2)
            for(var i=s1.options.length-1;i>=0;i--){
                    if(s1.options[i].selected){
                            s2.options.add(new Option(s1.options[i].text,s1.options[i].value))
                            s1.options.remove(i);
                        }
                }
        }
</script>
<body>
        <div style="float:left; width:50px; height:30px;">
           <select multiple="multiple" id="s1">
                <option value="00">00t</option>
                <option value="11">11t</option>
                <option value="22">22t</option>
            </select>
        </div>
        <div style="float:left; width:40px; height:30px;">
            <input type="button" value="&gt;" onclick="change(‘s1‘,‘s2‘)" /><br /><br />
            <input type="button" value="&lt;" onclick="change(‘s2‘,‘s1‘)" />
         </div>
        <div style="float:left; width:50px; height:30px;">
            <select multiple="multiple" id="s2">
            </select>
        </div>
                
</body>
</html>

 

slected多选框的转移

原文:http://www.cnblogs.com/321qwe/p/4143282.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!