Javascript Copy Selected Text Box Select All Highlight Text Form Copy Paste

Mobile
feeds
Welcome Login | Register

Javascript Copy Selected Text Box Select All Highlight Text Form Copy Paste
Reply Your Comments:
Click this button if you are interested in replying to this topic and leave your comments
Sent To Friend
CLick this button if you want to send this page to a friend.
Subsribe To Rss Feeds
Subscribe to RSS
CLick this button if you want to subscribe to this RSS Feed. You can use your browsers feeds burners if you have mozilla or internet explorer 7 or higher and keep up with updates.
  Forums Index
      » Javascipt Forums
        » » Javascript Copy Selected Text Box Select All Highlight Text Form Copy Paste
Javascript Copy Selected Text Box Select All Highlight Text Form Copy Paste
Post Description: javascript copy selected text box select all highlight text form copy paste Javascipt
Post Tags:
This Post Has Been Viewed 18014 Times Since Thu Jan 11, 2007 4:18 pm Author braker with 18 replies
Javascript Copy Selected Text Box Select All Highlight Text Form Copy Paste
Advertise On This Page




javascript is cool for making things in your browser, here is an example script to show you how you can put this on your site so that you don't have to hit the control + c on you keyboard to copy and paste the selected text in web forms.
here is a demo:



here is the code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Select Copy Text Into Clipboard History with Javascript</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function copyit(theField) {
var selectedText = document.selection;
if (selectedText.type == 'Text') {
var newRange = selectedText.createRange();
theField.focus();
theField.value = newRange.text;
} else {
alert('Alert: Select The text in the textarea then click on this button');
}
}
// End -->
</script>
</head>

<body>
<p><strong>Select Copy Text Into Clipboard History with Javascript by Wallpaperama.com </strong></p>
<p><strong>Steps:</strong></p>
<p><strong>1. Hight the text inside the text area below</strong></p>
<p><strong>2. Click on the form button, this will copy the text into your clipboard (basically the same as hitting control + c on your keyboard)</strong></p>
<form name="javascript">

<input onclick="copyit(this.form.text_select)" type="button" value="Click Here to Copy the Highlighted Text" name="copy_button">
<p>
<textarea name="text_select" cols="35" rows="5" wrap="VIRTUAL">FREE WALLPAPERS An Amazing collection of High quality, high resolution wallpapers for your computer desktop for free. Download your favorite high resolution wallpaper for free at wallpaperama.com. Our free wallpapers include a large collection of wallpapers for your computer desktop. You will find only free wallpapers, no pop-up ads, no spam, no spyware only high quality free wallpapers for your computer background. Surf with confidence.
</textarea>
</form>
<div align="center">
<p align="left">If you learned or liked this script, we would appriciate puting a link of <a href="http://www.wallpaperama.com">wallpaperama.com</a> on your site. If you would like to exchange links with us, please <a href="http://www.wallpaperama.com/exchange-links.php">click here</a> to exchange links </p>
<p>Hosting By <a href="webune.com">Webune.com</a> </p>
</div>
</body>
</html>



Try it on your website, you will like it

here is another way to select the content in a field with javascript: check it out

javascript select all text form button

NOTE: This will work on Internet Explorer. I tried it on Mozilla Firefox but i did not do anything. i was hoping someone can help me with firefox?


Leave Your Comments

Your Name
Your Email Address (Will Not Be Published)
Notify Me When Someone Replies to this Page
(An email will be sent to you when someone replies to your comments)
Your Comments
Include A Picture with your comments
Share
| More
Share this page by putting this URL in your comments to other websites like myspace, Facebook, Twitter friendster, Hi5, Groups, Boards, Forum or others. Just Copy and Paste this Code
URL:
To embed this topic, just copy the code from the "Embed" box. Once you've copied the code, just paste it into your website or blog to embed it.
Embed:
BBCODE is use on forums. You can put this code on all your BBCODE enabled forums like PhpBB, vBulletin® and others. Just Copy and Paste this code on your Posts and Replies on your forums
BBCODE:
Subscribe Feeds
Webmasters - Exchange Links With Us. Add related websites to this topic
Add Link:
Links Related to : Javascript Copy Selected Text Box Select All Highlight Text Form Copy Paste

Comments and replies About Javascript Copy Selected Text Box Select All Highlight Text Form Copy Paste
:: 1 :: Reply #251 Reply By ajax On Thu Feb 08, 2007 12:07 am
ajax:
this isa good java script code to copy text into clipboard using javascript. ihave plent of Text Box Select All Highlight Text using this.select JavaScript - Dynamic options JavaScript - Get selection Dynamic options Page Details: Highlighted Text Web - Capturing Selected Text with JavaScript Using Javascript to add tags to selected text in textarea change selected text using button - Other languages Get Selected Text. Using JavaScript to Create a Powerful GUI Select Object Selected Text Replacement Selecting text function or method that returns selected Select Box Text Tags Text Effects get value of selected text access to selected text modifying Advanced JavaScript Editor highlighted text Detect selected text with JavaScript Getting the selected text
:: 2 :: Reply #3346 Reply By maker On Thu May 17, 2007 7:09 pm
maker:
thanks for this javascript copy form values clipboard
:: 3 :: Reply #25637 Reply By muthaiah On Thu Oct 25, 2007 1:17 pm
muthaiah:
the above code is does not support in firefox browser.so how to use above code.
:: 4 :: Reply #26354 Reply By lion On Fri Nov 02, 2007 10:53 am
lion:
did not work on my end, using the latest ie.
:: 5 :: Reply #31859 Reply By ashley On Sun Dec 16, 2007 4:29 am
ashley:
thank you
:: 6 :: Reply #36502 Reply By vishadev On Tue Jan 15, 2008 5:03 am
vishadev:
without giving your full efforts to anything in your life, you can't justify your strengths and weakness....everybody lacks something in life....nobody is populated with each and every quality, a man should have? are really think like this.....so come forward, give upper hand to us...we will try to pull you for more details log on healthylivingpvtltd or e-mail to:enquiry at enbloc.biz (id no.393 )

:: 7 :: Reply #36503 Reply By vishadev On Tue Jan 15, 2008 5:04 am
vishadev:
without giving your full efforts to anything in your life, you can't justify your strengths and weakness....everybody lacks something in life....nobody is populated with each and every quality, a man should have? are really think like this.....so come forward, give upper hand to us...we will try to pull you for more details log on healthylivingpvtltd or e-mail to:enquiry at enbloc.biz (id no.393 )

:: 8 :: Reply #43144 Reply By Angai On Tue Feb 26, 2008 1:39 am
Angai:
its good.

i want to apply bold to the selected part of text in a textbox control.
is it possible? if so plz help me in coding.
:: 9 :: Reply #64315 Reply By Carrie On Fri Aug 01, 2008 6:27 am
Carrie:
did not work for me either...
:: 10 :: Reply #65585 Reply By asd On Fri Aug 08, 2008 10:15 pm
asd:
hey go to youtubeadds.blogspot to get more friends then nigahiga!!
:: 11 :: Reply #72903 Reply By You On Mon Sep 29, 2008 2:25 am
You:
this is dr.dre
:: 12 :: Reply #75577 Reply By Nishant On Wed Oct 15, 2008 5:04 am
Nishant:
sorry to say but it did not work in firefox. can you send me a cross browser code for 'copy to clipboard' functionality.
:: 13 :: Reply #79081 Reply By muniaswari On Sun Nov 02, 2008 7:54 pm
muniaswari:
i want to bold the selected text of textarea box by clicking button using javascript
:: 14 :: Reply #84977 Reply By adnreas On Fri Dec 05, 2008 11:41 pm
adnreas:
please teach me how to put a value in the textbox when we click a button using java script
:: 15 :: Reply #99039 Reply By yogesh On Thu Apr 02, 2009 5:39 am
yogesh:
i find the below link was useful supported multi-browser
<a href=" logiclabz /javascript/copy-to-clipboard-with- to clipboard javascript firefox ie</a>
:: 16 :: Reply #103598 Reply By Henk On Mon May 18, 2009 4:32 am
Henk:
download java from original page then it will work see for yourself
:: 17 :: Reply #109299 Reply By Pramod On Tue Jul 14, 2009 3:05 am
Pramod:
can modify the code for this to work in firefox. this isnt working now
:: 18 :: Reply #110040 Reply By genial On Tue Jul 21, 2009 1:22 am
genial:
it's not works at all...!!! and also the demo thing up there :(

<a href=" 6raphic.blogspot ">genial</a>