Widget.Select - Useful functions to manipulate HTML Select elements
<select id=left multiple=1 size=20>
<option>One</option>
<option>Two</option>
<option>Three</option>
<option>Four</option>
<option>Five</option>
<option>Six</option>
<option>Seven</option>
<option>Eight</option>
</select>
<button onclick='Widget.Select.moveSelectedOptionsTo("left", "right")'>move right</button>
<button onclick='Widget.Select.moveSelectedOptionsTo("right", "left")'>move left</button>
<select id=right multiple=1 size=20>
</select>
<button onclick='Widget.Select.moveSelectedOptionsUp("left")'>UP</button>
<button onclick='Widget.Select.moveSelectedOptionsDown("left")'>DOWN</button>
This module provides a collection of "static" functions that manipulate HTML Select form input elements. The target Select element can be passed as DOM object or DOM object ID (string).
Widget.Select.selectAll(elem);
Select all options.
Widget.Select.selectNone(elem);
Unselect all options.
Widget.Select.invertSelection(elem);
Unselects all selected options and selects all other options.
Widget.Select.moveSelectedOptionsUp(elem);
Rearranges the order of the options within the Select element by moving all selected options up one position. The options remain selected.
Widget.Select.moveSelectedOptionsDown(elem);
Rearranges the order of the options within the Select element by moving all selected options down one position. The options remain selected.
Widget.Select.moveSelectedOptionsTo(sourceElem, targetElem);
Moves the selected options from one Select element into another Select element. The options remain selected, are placed under all options already in the target element, and are removed from their original element.
Nothing.
Thilo Planz <thilo@cpan.org>
The JSAN module Widget.PairedMultiSelect
by Dave Rolsky also deals with (a specialised version of) Select elements.
COPYRIGHT
Copyright (c) 2005 Thilo Planz . All rights reserved.
This module is free software; you can redistribute it and/or modify it
under the terms of the Artistic license.