zoukankan      html  css  js  c++  java
  • slected多选框的转移

    <!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; 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; 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; 50px; height:30px;">
                <select multiple="multiple" id="s2">
                </select>
            </div>
                    
    </body>
    </html>
  • 相关阅读:
    Beta/Gamma事后分析
    Gamma阶段发布说明
    Gamma阶段测试报告
    展示时测试Markdown渲染
    Gamma阶段项目展示
    [技术博客] 主题适配指南
    【Gamma】Scrum Meeting 10
    [技术博客]升级 API 面临的问题
    [技术博客] JS正则活学活用
    【Gamma】Scrum Meeting 9
  • 原文地址:https://www.cnblogs.com/321qwe/p/4143282.html
Copyright © 2011-2022 走看看