Solved

copy all text with one click

Posted on 2004-04-17
2
218 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

772 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