PDA

View Full Version : Multiple Select Field Copyer



fileserverdirect
09-30-2007, 09:38 PM
Hello,
How would you Copy all the options in one "multiple" select field and put them into another one. By "Multiple" I mean: <select size=5>... not chained select feilds. Basicly, What I origanally tryed was:

document.dwn.DownloadList.options = document.theform.PickList.options
But It did not work. Any Questions will be answerd.
Thanks.

jscheuer1
10-01-2007, 04:57 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function dupe_opts(dd1, dd2){
for (var i = 0; i < dd1.options.length; i++)
dd2.appendChild(dd1.options[i].cloneNode(true));
}
</script>
</head>
<body>
<form action="#">
<select name="one" size=5>
<option value="">first</option>
<option value="">second</option>
<option value="">third</option>
<option value="">forth</option>
<option value="">fifth</option>
<option value="">sixth</option>
<option value="">seventh</option>
<option value="">eighth</option>
</select><br>
<input type="button" value="Dupe" onclick="dupe_opts(this.form.one, document.forms[1].two);">
</form>
<form action="#">
<select name="two">
</select>
</form>
</body>
</html>