View Full Version : textbox to multi-select

04-23-2008, 11:37 AM
hi กก
I have a textbox and I want spend their content in text to the list selected of a select multiple.
I found code to do the opposite mode but I don't serve for me.
Someone can help me?

Thanx :thumbsup:

04-23-2008, 01:42 PM
something like this perhaps:

<?xml version="1.1" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<select id="menu" multiple="multiple" size="4">
<option value="Item #1">Item #1</option>
<option value="Item #2">Item #2</option>
<option value="Item #3">Item #3</option>
<option value="Item #4">Item #4</option>
<p><input type="text" id="newtext" /> <input type="button" value="Send to Menu" onclick="sendToMenu('newtext','menu');" /></p>

<script type="text/javascript">
function sendToMenu(textBoxID,menuID)
var txtBox = document.getElementById(textBoxID);
var menu = document.getElementById(menuID);
var regex = /^[\s]+$/;

if (!regex.test(txtBox.value) && txtBox.value != "")
var newOption = document.createElement("option");
newOption.value = newOption.innerHTML = txtBox.value;
menu.size += 1;

txtBox.value = "";


04-23-2008, 03:13 PM
:thumbsup::thumbsup::thumbsup::thumbsup: Is perfect

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum