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

RegisterLogin
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
Tags: Javascript, Copy, Selected, Text, Box, Select, All, Highlight, Text, Form, Copy, Paste
This Post Was Posted On Oct 26, 2009 By braker #1407
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.


     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

EXAMPLE:

Steps:

1. Hight the text inside the text area below

2. Click on the form button, this will copy the text into your clipboard (basically the same as hitting control + c on your keyboard)

Leave Your Comments
WEbguy
#4890 1
needs comments for what each line of code actually does. this should help even more.
Mar 09, 2011 Reply Report abuse
kml
#4799 2
kjlkjp;o[p[op[i[i[
Jan 31, 2011 Reply Report abuse
asrocool
#4362 3
nice tutortial
Aug 17, 2010 Reply Report abuse
blahblah
#2666 4
blah blah 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
Oct 26, 2009 Reply Report abuse
Angai
#1848 5
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.
Feb 26, 2008 Reply Report abuse
vishadev bhakta
#1847 6
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 )

Jan 15, 2008 Reply Report abuse
vishadev bhakta
#1846 7
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 )

Jan 15, 2008 Reply Report abuse
ashley
#1845 8
thank you
Dec 16, 2007 Reply Report abuse
lion
#1844 9
did not work on my end, using the latest ie.
Nov 02, 2007 Reply Report abuse
muthaiah
#1843 10
the above code is does not support in firefox browser.so how to use above code.
Oct 25, 2007 Reply Report abuse
maker
#1842 11
thanks for this javascript copy form values clipboard
May 17, 2007 Reply Report abuse
ajax
#1841 12
this isa good java script code to copy text into clipboard using javascript.
Feb 08, 2007 Reply Report abuse
Leave Your Comments...
©2011 Webune Forums - Tue Dec 20, 2011 2:56 am
Powered by: Webune Forums V3