Script copies a table or a text to the clipboard. After this you can use the normal paste function in any program. Most common use of the script: transfer data from web into a spreadsheet program (like Excel).
Compatibility:
| fruit | piece | price |
| apple | 12 | 5 |
| peach | 23 | 3 |
Use div tags with unique ids to specify the right table or text to be copied.
<div id="sample2">
Sample text shows the function of clipboard copy from javascript.
</div>
Then put OnClick action on a link or a button. The copy_clipboard function has only one argument, which is the id of the div to be copied.
<input type="button"
onclick="copy_clipboard('sample2');"
class="ib" value="Copy the text">
download (source and documentation)