Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2014
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.82 KB | None | 0 0
  1. http://forum.imasters.com.br/topic/524065-receber-no-post-valores-de-duas-listbox/
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml">
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <title>Usuario</title>
  8. <meta name="" content="" />
  9. <script language="JavaScript">
  10. function move(src, dst){
  11.  
  12.     MenuDestino = document.getElementById(dst);
  13.     MenuOrigem = document.getElementById(src);
  14.     var arrMenuOrigem = new Array();
  15.     var arrMenuDestino = new Array();
  16.     var arrLookup = new Array();
  17.     var i;
  18.     for (i = 0; i < MenuDestino.options.length; i++){
  19.        arrLookup[MenuDestino.options[i].text] = MenuDestino.options[i].value;
  20.        arrMenuDestino[i] = MenuDestino.options[i].text;
  21.    }
  22.    var fLength = 0;
  23.    var tLength = arrMenuDestino.length;
  24.    for(i = 0; i < MenuOrigem.options.length; i++){
  25.        arrLookup[MenuOrigem.options[i].text] = MenuOrigem.options[i].value;
  26.        if (MenuOrigem.options[i].selected && MenuOrigem.options[i].value != ""){
  27.            arrMenuDestino[tLength] = MenuOrigem.options[i].text;
  28.            tLength++;
  29.        }
  30.        else{
  31.            arrMenuOrigem[fLength] = MenuOrigem.options[i].text;
  32.            fLength++;
  33.        }
  34.    }
  35.    arrMenuOrigem.sort();
  36.    arrMenuDestino.sort();
  37.    MenuOrigem.length = 0;
  38.    MenuDestino.length = 0;
  39.    var c;
  40.    for(c = 0; c < arrMenuOrigem.length; c++){
  41.        var no = new Option();
  42.        no.value = arrLookup[arrMenuOrigem[c]];
  43.        no.text = arrMenuOrigem[c];
  44.        MenuOrigem[c] = no;
  45.    }
  46.    for(c = 0; c < arrMenuDestino.length; c++){
  47.        var no = new Option();
  48.        no.selected = true;
  49.        no.value = arrLookup[arrMenuDestino[c]];
  50.        no.text = arrMenuDestino[c];
  51.        MenuDestino[c] = no;
  52.   }
  53. }
  54. </script>
  55. </head>
  56.  
  57. <body class="ex_highlight_row">
  58.  
  59. <form name="combo_box" action="logado.php" method="post">
  60. <center>Nome:<input type="text" name="nome" size="15" /></center>
  61.    
  62.     <table>
  63.    
  64.    
  65.     <tr><td>Selecione os Bairros</td><td></td><td>Bairros Selecionados</td><tr>
  66.         <tr>
  67.             <td>
  68.                 <select multiple size="10" name="list1" id="list1" style="width:150">
  69.                 <option value="value1">value1</option>
  70.                 <option value="value2">value2</option>
  71.                 </select>
  72.             </td>
  73.             <td align="center" valign="middle">
  74.                 <input type="button" onClick="move('list2','list1')" value="<<">
  75.                 <input type="button" onClick="move('list1','list2')" value=">>">
  76.             </td>
  77.             <td>
  78.                 <select multiple size="10" name="list2[]" id="list2" style="width:150px">
  79.                 </select>
  80.             </td>
  81.         </tr>
  82.     </table>
  83.    
  84.    
  85.     <table>
  86.     <br /><br /><br />
  87.    
  88.     <tr><td>Selecione os Empacotador</td><td></td><td>Empacotador Selecionados</td><tr>
  89.         <tr>
  90.             <td>
  91.                 <select multiple size="10" name="list3" id="list3" style="width:150">
  92.                 <option value="value1">value1</option>
  93.                 <option value="value2">value2</option>
  94.                 </select>
  95.             </td>
  96.             <td align="center" valign="middle">
  97.                 <input type="button" onClick="move('list4','list3')" value="<<">
  98.                 <input type="button" onClick="move('list3','list4')" value=">>">
  99.             </td>
  100.             <td>
  101.                 <select multiple size="10" name="list4[]" id="list4" style="width:150px">
  102.                 </select>
  103.             </td>
  104.         </tr>
  105.     </table>
  106.    
  107.     <input type="submit" value="cadastrar" />
  108.    
  109. </form>
  110.  
  111. <p><a href="index.php" class="button">voltar</a></p><br /><br />
  112. </body>
  113. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement