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>
  • 相关阅读:
    热烈祝贺自己的博客进入前1000名
    烈日之后逛成都
    懂得爱情
    腾飞天涯
    哈佛教授教你成为No.1的秘诀
    烈日炎炎
    有缘无份——因为伤感所以美丽
    时间管理
    亲爱的陌生人(转)
    走好激励第一步
  • 原文地址:https://www.cnblogs.com/321qwe/p/4143282.html
Copyright © 2011-2022 走看看