I need functionality for copy the textarea content and paste into my notepad itself.
I am searching in net also they available for IE only . I need compatability for all browsers.
Please urgently i need this.......
Please i need clipboard copy function
Moderator: General Moderators
Re: Please i need clipboard copy function
I don't quite understand what you want. The textarea is displayed on your browser or do you want to extract it remotely?
You have to access the clipboard on the client side, so try javascript. Here is how you set and get text with a javascript in IE.
In mozilla/firefox it is a bit more involved see http://www.logiclabz.com/javascript/cop ... nd-ie.aspx
Edit: while the swf technique works on my mozilla microbrowser, it is generally considered a security risk for the browser to access clipboard data and I think some versions now block this.
You have to access the clipboard on the client side, so try javascript. Here is how you set and get text with a javascript in IE.
Code: Select all
var bResult =
window.clipboardData.setData("Text","SAMPLE");
var text = window.clipboardData.getData("Text");
alert('window.clipboardData: '+text);Code: Select all
function copy_to_clipboard(text)
{
if(window.clipboardData)
{
window.clipboardData.setData('text',text);
}
else
{
var clipboarddiv=document.getElementById('divclipboardswf');
if(clipboarddiv==null)
{
clipboarddiv=document.createElement('div');
clipboarddiv.setAttribute("name", "divclipboardswf");
clipboarddiv.setAttribute("id", "divclipboardswf");
document.body.appendChild(clipboarddiv);
}
clipboarddiv.innerHTML='<embed src="clipboard.swf" FlashVars="clipboard='+
encodeURIComponent(text)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
}
alert('The text is copied to your clipboard...');
return false;
}