Note: This script is not valid for browsers other than IE cores. to be compatible with the full browser, you can use the plugin +flash control method, specific click compatible with each browser to copy the text box content of the jquery plugin
Here's how to use it:
After introducing jquery, execute the following function code:
$ (function () {$ ("#d_clip_button"). Click (function () {var url=$ ("#yao_txt"). Text (); CopyToClipboard (URL); });});
The functions of CopyToClipboard are as follows:
Function copytoclipboard (Maintext) { if (window.clipboarddata) { Window.clipboardData.setData ("Text", maintext); }else if ( Window.netscape) { try{ Netscape.security.PrivilegeManager.enablePrivilege ("Universalxpconnect"); }catch (e) { alert ("The browser does not support one-click Replication!") \ n Please manually copy the text box link address ~ "); } var clip = Components.classes[' @mozilla. Org/widget/clipboard;1 '].createinstance (Components.interfaces.nsIClipboard); if (!clip) return; var trans = Components.classes[' @mozilla. Org/widget/transferable;1 '].createinstance (Components.interfaces.nsITransferable) ; if (!trans) return; trans.adddataflavor (' Text/uniCode '); var str = new object (); var len = new object (); var str = components.classes["@ Mozilla.org/supports-string;1 "].createinstance (Components.interfaces.nsISupportsString); var copytext=maintext; str.data=copytext; Trans.settransferdata ("Text/unicode", str,copytext.length*2); var clipid= components.interfaces.nsiclipboard; if (!clip) return false; clip.setdata (Trans,null,clipid.kglobalclipboard); } alert ("The following has been copied to the Clipboard \ n" + maintext);}
General script for copying text box contents