while I second the Pengoworks recommendation by Mr. Tangorre, i've got the
following that should work:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled</title>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1" />

<script type="text/_javascript_">
  function moveOption(eFrom,eTo) {
   var moveFrom = document.forms[0].elements[eFrom];
   var moveTo   = document.forms[0].elements[eTo];

   // adding...
   for (var i=0; i<moveFrom.options.length; i++) {
    if (moveFrom.options[i].selected == true) {
     moveTo.options[moveTo.options.length] = new
Option(moveFrom.options[i].text);
    }
   }

   // removing...
   for (var i=moveFrom.options.length-1; i>=0; i--) {
    if (moveFrom.options[i].selected == true) {
     moveFrom.options[i] = null;
    }
   }
  }
</script>
</head>

<body>

<form>
<select name="list_1" style="width:100px;" multiple="multiple" size="10">
  <option value="a">a</option>
  <option value="b">b</option>
  <option value="c">c</option>
  <option value="d">d</option>
  <option value="e">e</option>
  <option value="f">f</option>
  <option value="g">g</option>
</select>

<input type="button" value="&laquo;" style="width:20px;"
/>
<input type="button" value="&raquo;" style="width:20px;"
/>

<select name="list_2" style="width:100px;" multiple="multiple" size="10">
</select>
</form>

</body>
</html>

----- Original Message -----
From: "Burns, John D" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, March 15, 2004 11:22 AM
Subject: _javascript_ select code?

> I've got two multiple selects that I'm using for a mass mail program.
> One has a list of all of the available email addresses in it, the other
> starts off empty.  When someone selects some addresses from the first
> box and clicks a button, I want to move the selected options over to the
> other textbox and remove them from the first textbox.  Does anyone have
> any code for doing this?  I know I've seen it before, and I'm sure I
> could write it, but if someone has something that I could easily make
> some changes to and have it work, I'd appreciate it.
>
> John
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to