Solved

copy all text with one click

Posted on 2004-04-17
2
216 Views
Last Modified: 2008-03-06
Can anyone a specific task I'm trying to achieve.

I have a form with a text box. Currently if user wanted to copy all the text in the textbox, they would have to highlight all the text and right click and select copy.  

I'd like to give the user the ability to copy all text with one click.

thanks,

john
0
Comment
Question by:jjbarnsley
2 Comments
 
LVL 12

Accepted Solution

by:
venkateshwarr earned 500 total points
ID: 10849769
Javascript would be enought..

<SCRIPT LANGUAGE="JavaScript">

function CopyText()
{
   r=document.forms[0].text_area.createTextRange();
   r.select();
   r.execCommand('copy');
}

</SCRIPT>
<center>
<form name="select_all">

<input type=text name="text_area" rows="10" cols="80" value="1 2 3 ">

<br>
<input type="button" value="Highlight & Copy Text"  onClick="javascript:this.form.text_area.focus();this.form.text_area.select();CopyText()">

</form>
</center>
0
 

Author Comment

by:jjbarnsley
ID: 10849773
thanks I'll try that.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now