Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Toggle shoutbox Shoutbox Open the Shoutbox in a popup

@  yordan : (21 April 2014 - 09:11 PM) Hey, Ritesh, Did You Hear Me?
@  yordan : (14 April 2014 - 05:28 PM) By The Way, This Could Be An Interesting Subject For A Topic, What About Posting This Question? Let's See If Other People Have The Same Feeling Concerning Bootlists!
@  yordan : (13 April 2014 - 09:36 AM) Boot Order : Cd, [Usb,] Hard Drive :D
@  yordan : (11 April 2014 - 07:23 PM) I Simply Let The Bios Do That
@  Ritesh : (11 April 2014 - 10:23 AM) Is It Possible To Launch Fedora Live Cd Or Installation Disk From Hard Drive On Windows Platform Using Grub Mbr File.
@  Ritesh : (11 April 2014 - 10:21 AM) No U Are Not.. Btw.. I Have Question For You.
@  yordan : (10 April 2014 - 08:02 AM) You Are Partially Right.
I Was Not.
Nevertheless, I Am Again :)
@  Ritesh : (09 April 2014 - 07:33 PM) :P
@  Ritesh : (09 April 2014 - 07:33 PM) I Think U R Not..
@  yordan : (09 April 2014 - 09:28 AM) I'm The Master Of The Shoutbox!
@  yordan : (05 April 2014 - 10:32 PM) He-He
@  Ritesh : (04 April 2014 - 06:59 PM) Ha Ha Ha ....
@  yordan : (04 April 2014 - 11:15 AM) Welcome Back, Starscream!
@  yordan : (03 April 2014 - 02:31 PM) And I Hope That He Will Come Back Soon :)
@  yordan : (01 April 2014 - 02:53 PM) Nice, Ritesh Came, I'm Not Home Alone Today.
@  Ritesh : (01 April 2014 - 08:51 AM) Oh!!! Poor Dear Yordan..
@  yordan : (31 March 2014 - 10:02 AM) I'm A Poor Lonesome Cow-Boy
@  yordan : (27 March 2014 - 02:22 PM) He Is Unpatient Due To His Patients!
@  Ritesh : (27 March 2014 - 10:46 AM) :(
@  Ritesh : (27 March 2014 - 10:46 AM) He Is Busy With His Patients.

- - - - -

One Click To Copy Script Works in IE6 but not any other Browsers


  • This topic is locked This topic is locked
No replies to this topic

#1 Guest_jlhaslip_*

Guest_jlhaslip_*
  • Guests

Posted 17 February 2007 - 06:19 AM

As a project to "boilerplate" some text, I had this idea of making a couple of textareas in html and having a single click on the input button copy the contents to the clipboard and then pasting the text into another blank textarea. Several textareas would contain the different pieces of text and I would then be able to 'assemble' the full text into the 'blank' textarea and then, of course, copy this entire piece to the clipboard and migrate it to the final spot for copying. Anyways, BuffaloHELP had the basic code for the javascript, but it seems that this code only works in Internet Explorer. I understand the Gecko Browsers (and Opera/Netscape) use a different scripting language.
Could you folks have a look to see what would need to be done to this code to get it working cross-browser?

Thanks a bunch...

LINK REMOVED jlhaslip

Source code here:

[codebox]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR...l4/strict.dtd">
<html>
<head>
<title>Javascript for one-click highlight and copy to clipboard</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" >
<meta http-equiv="Content-Style-Type" content="text/css" >
</head>
<body>

&lt;script type="text/javascript">
function doact(d)
{
var doc = eval("document.readme."+d);
cp = doc.createTextRange();
doc.focus();
doc.select();
cp.execCommand("Copy");
}
</script>
<div>
<form name="readme" action="#">
<p style="float:left">
<textarea name="text1" cols="10" rows="2">
1. -Your basic HTML codes can be entered here.</textarea>
<br>
<input onclick="doact('text1')" type="button" value="Quote">
</p>

<p style="float:left">
<textarea name="text2" cols="30" rows="2">
2. -This textarea is the second textbox for copying.
2. -This textarea is the second textbox for copying.</textarea>
<br>
<input onclick="doact('text2')" type="button" value="Longer Quote">
</p>

<p style="float:left">
<textarea name="text3" cols="40" rows="2">
3. -This textarea is to demonstrate the inclusion of the third textbox for copying.
3. -This textarea is to demonstrate the inclusion of the third textbox for copying.
3. -This textarea is to demonstrate the inclusion of the third textbox for copying.</textarea>
<br>
<input onclick="doact('text3')" type="button" value="Still A Longer Quote">
<br style="clear:both" />
</p>
<p style="clear:both" ></p>
<p><strong>Add Information To <em>This Work Area</em> To Build Your Posting</strong></p>
<p>
<textarea name="text4" cols="60" rows="8">
</textarea>
<br>
<input onclick="doact('text4')" type="button" value="Main Text area">
<input type="reset" value="Clear The Form">
</p>
</form>
</div>
</body>

</html>[/codebox]

Forever grateful!

Edited by jlhaslip, 11 March 2007 - 02:16 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users