1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| <head runat="server"> <title>无标题页</title> <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#add').click(function(){ var options=$('#select1 option:selected'); var remove=options.remove(); remove.appendTo("#select2"); }); $('#addAll').click(function(){ var options=$('#select1 option'); var remove=options.remove(); remove.appendTo("#select2"); }); $('#remove').click(function(){ var options=$('#select2 option:selected'); var remove=options.remove(); remove.appendTo("#select1"); }); $('#removeAll').click(function(){ var options=$('#select2 option'); var remove=options.remove(); remove.appendTo("#select1"); }); }); </script> </head> <body> <form id="form1" runat="server"> <div id="left"> <select multiple="multiple" id="select1" style="width:100px;height:160px"> <option>选项1</option> <option>选项2</option> <option>选项3</option> <option>选项4</option> <option>选项5</option> </select> </div> <div> <span id="add">选中项添加至右边>></span><br /> <span id="addAll">全部添加到右边>></span> </div> <div id="right"> <select multiple="multiple" id="select2" style="width:100px;height:160px"></select> </div> <div> <span id="remove"><<选中项还原至左边</span><br /> <span id="removeAll"><<全部还原至左边</span> </div> </form> </body>
|