473,668 Members | 2,600 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copy from a list to a textarea

Hello,

Can anyone help me with the following, or point me to a site that can help:

I have a list of words in a List and I want a user to be able to select
several words from this list, hit a button and these words appear in a
textarea.

Thanks in advance for your help.

Gram.
Jul 20 '05 #1
3 6236
"Gram" <gr******@hotma il.com> writes:
Hello,

Can anyone help me with the following, or point me to a site that can help:

I have a list of words in a List and I want a user to be able to select
several words from this list, hit a button and these words appear in a
textarea.


I assume your "List" is a select element.

Code:
---
<script type="text/javascript">
function transferWords() {
var optsRef = document.getEle mentById("selec tId").options;
var textRef = document.getEle mentById("texta reaId");
var words = [];
for (var i=0;i<optsRef.l ength;i++) {
if (optsRef[i].selected) {
words.push(opts Ref[i].text);
}
}
textRef.value = words.join(" ");
}
</script>

<select id="selectId" multiple="multi ple">
<option>Some</option>
<option>Words </option>
<option>To</option>
<option>Selec t</option>
<option>From</option>
</select>
<input type="button" value="Transfer Words" onclick="transf erWords()">
<textarea id="textareaId" >Words appear here</textarea>
---

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
"Gram" <gr******@hotma il.com> wrote in message news:<FY******* *********@news. indigo.ie>...
Hello,

Can anyone help me with the following, or point me to a site that can help:

I have a list of words in a List and I want a user to be able to select
several words from this list, hit a button and these words appear in a
textarea.

Thanks in advance for your help.

Gram.


Gram,

Check the attached code, I think is what you're looking for.

Wagner

-----
<html>
<head>
<script language=JavaSc ript>
function copy(){
var o, i;
with(document.m yform){
myarea.value = '';
for (i=0; i < mylist.options. length; i++){
o = mylist.options[i];
if (o.selected){
if (myarea.value != '')
myarea.value += '\n';
myarea.value += o.text;
}
}
}
}
</script>
</head>
<body>
<form name=myform>
<select name=mylist multiple>
<option>Text 1
<option>Text 2
<option>Text 3
<option>Text 4
<option>Text 5
<option>Text 6
</select>
<br><br>
<input type=button name=mybtn value="Copy" onclick="copy() ;">
<br><br>
<textarea name=myarea rows=20>
</textarea>
</form>
</body>
</html>
Jul 20 '05 #3
Wagner

Thats it, Thank you!

Gram.
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2977
by: Mike | last post by:
I have a form that has a place for "Customer" and "CO-Customer" information. I want to put a button by the CO-Customer section that will copy the Address information from the Customer. Do I have that button be a Submit button that posts the information back to the form and the writes it? Mike
3
9540
by: cv | last post by:
Hi all, I have to copy two set of data from 2 files(notepad/excel) say, products and their corresponding prices to list/textarea/table. I should be able to retrieve the product and corresponding price information from the control(list/textarea/table). Which is the best way? Quite urgent.. pls let me know. TIA, cv
4
1270
by: just1coder | last post by:
Is it possible to create a dropdown list populated by the contents of a textarea? <textarea> <a name="this">this</a> <a name="that">that</a> </textarea> Then, the dropdown would have the <a> values as options... Please reply to
5
11165
by: Gernot Frisch | last post by:
How can I put text from a <textarea name="test"></textarea> into my clipboard (Windows, Firefox+IE). -- -Gernot int main(int argc, char** argv) {printf ("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);} ________________________________________ Looking for a good game? Do it yourself!
4
20998
by: devine | last post by:
Hi All, I am VERY new to Javascript. I have been provided with some code, which will enable me to hide/show a text area and change a submit button dependant on a check box. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
9
19830
by: Ajinkya | last post by:
Hello friends ! , I am very new to java script.If anyone can help me then I will be very very thankful to his/her. I am using php and mysql in my project and I have one textarea and one list boxes,now whenever user fill any value(email-Id) to textarea and press submit button then value going to listbox. These values are one or multiple , then they goes into list box , In list box these values are store in array . I mean user...
0
2276
by: saijin | last post by:
I'm planning to call a list of data from an XML file but when I duplicate the content inside the <data></data> it is not showing anything Here's the ActionScript 3.0 import fl.controls.ComboBox; import fl.controls.TextArea; import fl.containers.UILoader;
0
2396
by: saijin | last post by:
Are there anyway that I can add a checkbox on a component that supports "dataProvider" and HTML tags? Here's what I have so far: import fl.data.DataProvider; import fl.managers.StyleManager; import fl.controls.List; import fl.controls.TileList; import fl.controls.TextArea;
0
8371
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8889
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8790
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7391
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2782
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1779
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.