soundreamer
05-12-2007, 10:21 AM
Can some one give me a sample code of a function, which can be attached to an anchor in order to copy the content of a div with a specific id.
|
||||
Copy text by clicking on an anchorsoundreamer 05-12-2007, 10:21 AM Can some one give me a sample code of a function, which can be attached to an anchor in order to copy the content of a div with a specific id. smalldog 05-12-2007, 02:37 PM Do you mean copy to clipboard? Then try this code.. <script> function CopyToClipboard(id){ if (document.all) { window.clipboardData.clearData(); window.clipboardData.setData('Text',document.getElementById(id).innerHTML); } else alert('It works only in IE'); } </script> <div id="div1">hello world</div> <a href="Javascript:CopyToClipboard('div1');">Copy</a> soundreamer 05-14-2007, 10:31 PM Yes, thanks for the sample, but is it possible to have a function which will work for both IE and Firefox?:cool: abduraooft 05-15-2007, 07:55 AM Yes, thanks for the sample, but is it possible to have a function which will work for both IE and Firefox?:cool: yes, of course its here (http://www.krikkit.net/howtos/copy_text_to_clipboard_with_javascript.html) soundreamer 05-15-2007, 02:10 PM Thank you :) |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum