Jump to content
xisto Community
Sign in to follow this  
iGuest

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

Recommended Posts

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:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://forums.xisto.com/no_longer_exists/ 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><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>

Forever grateful!

Edited by jlhaslip (see edit history)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.