Copy Textarea W/ Button Click Help |
Copy Textarea W/ Button Click Help |
AngelsNecropolis |
Aug 1 2008, 10:45 PM
Post
#1
|
Group: Members Posts: 5 Joined: 30-July 08 Member No.: 6,299 |
Hello and thank you in advanced for help.
I want to create a button beneath the second textarea, located at the very end, labeled source, so that I click X button and it selects and copies all the text inside the second textarea. I have the code to make the button work properly on its own with it's own textarea but I can't seem to integrate it into the function below. Help please? QUOTE <html> <script type="text/javascript"> function generatecode(form){ textbody = document.inputform.textbody.value; customnotes = document.inputform.customnotes.value; customnotes = customnotes.replace(/#/,""); output = '<form ' + ((customnotes) ? 'name="formz' + customnotes + '' : '') + ' rows=1 cols=30>' + textbody + '</textarea>' + '</form>\n'; document.inputform.source.value = output; return output; } </script> <form id=inputform name=inputform onChange="java script:generatecode();"> <meta content="mshtml 6.00.2900.3354" name=generator></head> <textarea name=textbody rows=5 cols=30></textarea> <input value=1 name=customnotes> <input onclick="java script:generatecode();" type=button value=Generate Code> <textarea name=source rows=7 cols=30></textarea></form> Here is the Button Code I'm using. QUOTE <FORM name=Form1> <TEXTAREA id=txtArea1 rows=5 cols=60></TEXTAREA> <BR><INPUT onclick=CopyToClipboard1() type=button value="Copy to clipboard"> </FORM> <script type=text/javascript> function CopyToClipboard1() {document.Form1.txtArea1.focus(); document.Form1.txtArea1.select(); CopiedTxt = document.selection.createRange(); CopiedTxt.execCommand("Copy"); } </SCRIPT> This post has been edited by AngelsNecropolis: Aug 1 2008, 11:14 PM |
AngelsNecropolis |
Aug 1 2008, 11:32 PM
Post
#2
|
Group: Members Posts: 5 Joined: 30-July 08 Member No.: 6,299 |
I figured it out. How do I delete a post?
|
Lo-Fi Version | Time is now: 25th April 2024 - 10:55 PM |