pbolduc 0 Report post Posted December 8, 2007 I know how to code to get the text in a text area highlighted, I was wondering if anyone could provide me with the code to copy the content of a text area directly to the clipboard.Thanks in advance,Pete Share this post Link to post Share on other sites
TavoxPeru 0 Report post Posted December 9, 2007 (edited) A time ago i need a script to do this action, and after some searching i found how to do it. You say that you have the code that selects the content text of the textarea, so, simply add a button to your form which will perform the action of copying it to the clipboard when it is clicked and the following javascript function, you can place this function in an external javascript file or in the HEAD section of your page.Here is the Javascript code: function copy(text) { if (window.clipboardData) { window.clipboardData.setData("Text",text); }}And the button:<input type="button" value="Copy To Clipboard" onclick="copy(document.your_form_name.your_textarea_name.value);">I'm not pretty sure but i guess that it only works with Internet Explorer 6, i don't test it with any other browser.Check also this topic One Click To Copy Script, Works in IE6 but not any other BrowsersBest regards, Edited December 9, 2007 by TavoxPeru (see edit history) Share this post Link to post Share on other sites
pbolduc 0 Report post Posted December 19, 2007 Thanks man... sry I didn't thank you sooner but was on vacationpete Share this post Link to post Share on other sites
takashiro1405241549 0 Report post Posted December 20, 2007 A time ago i need a script to do this action, and after some searching i found how to do it. You say that you have the code that .....Thanks!! I am just finding it! Javascript copy function! I wonder if it will notice user to press "OK"? Share this post Link to post Share on other sites
TavoxPeru 0 Report post Posted December 20, 2007 Thanks man... sry I didn't thank you sooner but was on vacationpeteYou are welcome, do you test it in Firefox????Best regards, Share this post Link to post Share on other sites
TavoxPeru 0 Report post Posted December 20, 2007 Thanks!! I am just finding it! Javascript copy function! I wonder if it will notice user to press "OK"?You are welcome, and the function will not notice the user to press "OK" or any other key.Best regards, Share this post Link to post Share on other sites
iGuest 3 Report post Posted January 4, 2010 copy from excel and paste in web browserCopy To Clipboard FunctionHello,I need a code that copies the (selected single) row items from excel sheet to web browser's text area .-question by jitendra kumar Share this post Link to post Share on other sites