Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A library-independent solution:</p> <pre><code>function Move(inputControl) { var left = document.getElementById("Left"); var right = document.getElementById("Right"); var from, to; var bAll = false; switch (inputControl.value) { case '&lt;&lt;': bAll = true; // Fall through case '&lt;': from = right; to = left; break; case '&gt;&gt;': bAll = true; // Fall through case '&gt;': from = left; to = right; break; default: alert("Check your HTML!"); } for (var i = from.length - 1; i &gt;= 0; i--) { var o = from.options[i]; if (bAll || o.selected) { from.remove(i); try { to.add(o, null); // Standard method, fails in IE (6&amp;7 at least) } catch (e) { to.add(o); // IE only } } } } </code></pre> <p>HTML</p> <pre><code>&lt;select id="Left" multiple="multiple" size="10"&gt; &lt;option&gt;Some&lt;/option&gt; &lt;option&gt;List&lt;/option&gt; &lt;option&gt;Of&lt;/option&gt; &lt;option&gt;Items&lt;/option&gt; &lt;option&gt;To&lt;/option&gt; &lt;option&gt;Move&lt;/option&gt; &lt;option&gt;Around&lt;/option&gt; &lt;/select&gt; &lt;div id="Toolbar"&gt; &lt;input type="button" value="&amp;gt;" onclick="Move(this)"/&gt; &lt;input type="button" value="&amp;gt;&amp;gt;" onclick="Move(this)"/&gt; &lt;input type="button" value="&amp;lt;&amp;lt;" onclick="Move(this)"/&gt; &lt;input type="button" value="&amp;lt;" onclick="Move(this)"/&gt; &lt;/div&gt; &lt;select id="Right" multiple="multiple" size="10"&gt; &lt;/select&gt; </code></pre> <p>CSS (example)</p> <pre><code>select { width: 200px; float: left; } #Toolbar { width: 50px; float: left; text-align: center; padding-top: 30px; } #Toolbar input { width: 40px; } </code></pre> <p>Quick test FF3 and IE6 &amp; 7 only.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload