• 列表框的左右移动


     1 <!-- <script type="text/javascript"> 
     2 function move(a,b) 
     3 { 
     4    var aObj = document.getElementById(a); 
     5    var bObj = document.getElementById(b); 
     6    for(var i=0;i<aObj.length;i++) 
     7    { 
     8       if(aObj[i].selected) 
     9       { 
    10          var opt = new Option(aObj[i].text,aObj[i].value); 
    11          bObj.add(opt); 
    12          aObj.remove(i); 
    13          i--; 
    14       } 
    15    } 
    16 } 
    17 </script> 
    18 <table width="40%" border="1" bgcolor="#cecece"> 
    19    <tr> 
    20       <td><select id="left" size="6" multiple> 
    21          <option value="1">增加简历</option> 
    22          <option value="2">删除简历</option> 
    23          <option value="3">修改简历</option> 
    24          <option value="4">列表简历</option> 
    25       </select></td> 
    26       <td><input type="button" value=">>" 
    27          onclick="move('left','right')"><br> 
    28       <input type="button" value="<<" 
    29       onclick="move('right','left')"></td> 
    30       <td><select id="right" size="6" multiple style=" 80px"> 
    31       </select></td> 
    32    </tr> 
    33 </table> 
    34  -->
    35  <!DOCTYPE html>
    36  <html lang="en">
    37  <head>
    38      <meta charset="UTF-8">
    39     <title>Document</title>
    40      <!--引入框架-->
    41     <link href="resource/bootstrap/css/bootstrap.css" rel="stylesheet">
    42     <script src="resource/jQuery/jquery-1.11.3.js"></script>
    43     <script src="resource/bootstrap/js/bootstrap.js"></script>
    44 
    45     <!--引入自己的js-->
    46     <script src="js/demo1.js"></script>
    47 
    48     <style>
    49         /*css选择器:class,id,标签,复合选择器*/
    50     </style>
    51  <body>
    52      <script type="text/javascript"> 
    53     function move(a,b) 
    54     { 
    55        var aObj = document.getElementById(a); 
    56        var bObj = document.getElementById(b); 
    57        for(var i=0;i<aObj.length;i++) 
    58        { 
    59           if(aObj[i].selected) 
    60           { 
    61              var opt = new Option(aObj[i].text,aObj[i].value); 
    62              bObj.add(opt); 
    63              aObj.remove(i); 
    64              i--; 
    65           } 
    66        } 
    67     } 
    68     </script> 
    69     <table width="40%" border="1" bgcolor="#cecece"> 
    70        <tr> 
    71           <td><select id="left" size="6" multiple> 
    72              <option value="1">增加简历</option> 
    73              <option value="2">删除简历</option> 
    74              <option value="3">修改简历</option> 
    75              <option value="4">列表简历</option> 
    76           </select></td> 
    77           <td><input type="button" value=">>" 
    78              onclick="move('left','right')"><br> 
    79           <input type="button" value="<<" 
    80           onclick="move('right','left')"></td> 
    81           <td><select id="right" size="6" multiple style=" 80px"> 
    82           </select></td> 
    83        </tr> 
    84     </table> 
    85 
    86  </body>
    87  </html>
    ---- 动动手指关注我!或许下次你又能在我这里找到你需要的答案!ZZZZW与你一起学习,一起进步!
  • 相关阅读:
    Javascript--普通函数调用-涨工资计算函数
    Javascript--运算符判断成绩运算
    Javascript-闰年javascript的判断
    Javascript-逻辑判断或(&&)练习
    Javascript-短路 与(&&)
    UVALive6434_Number Assignment
    HDU4811_Ball
    HDU4810_Wall Painting
    HDU4803_Poor Warehouse Keeper
    HDU4802_GPA
  • 原文地址:https://www.cnblogs.com/zzzzw/p/4878422.html
Copyright © 2020-2023  润新知