Solved

copy all text with one click

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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

724 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