Solved

copy all text with one click

Posted on 2004-04-17
2
220 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
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…

735 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