Friday, 18 July 2014
COPY TEXT FROM CLIPBOARD EXAMPLE


Copy Div content to Clipboard
<div id="myDiv">This is the content to get copied to the text area and then to clipboard</div>
<script type="text/javascript">
function copy2cb()
{
// If it's FireFox, then sets the
// "signed.applets.codebase_principal_support" to TRUE
if (navigator.userAgent.indexOf("Firefox")!=-1)
user_pref("signed.applets.codebase_principal_support", true);
var ta= document.getElementById ("myhidta");
var d= document.getElementById ("code_collective");
// Transfer the text from the DIV to the hidden textarea
ta.innerText= d.innerText;
// create the text range
var t= ta.createTextRange ();
// do this if you wanna remove the format of the text within
t.execCommand('RemoveFormat');
// Then execute the copy command
t.execCommand('Copy');
}
</script>
<textarea style="display:none;" id="myhidta"></textarea>
<input type="button" value="Copy" onClick="copy2cb();"/>
-------------------------------------------------------------------------------------------------------
READ MORE:
--------------------------------------------------------------------------------------------------------
- http://www.y8.com/games/boule_and_bill
- http://www.freeonlinegames.com/game/fair-blue-lake-fairy
- http://code.hyperspatial.com/tag/clipboard/
- http://www.paulund.co.uk/playground/demo/zeroclipboard-demo/?target-to-copy
- http://fbgadgets.blogspot.co.uk/2014/07/basic-text-or-scroll-box-or-image-src.html
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment