FF, does not support the replication function, to support the words, it is difficult
JS replication features support for Ie/firefox/mozilla/ns
The code is as follows:
Here are two ways:
<script language= "javascript" type= "Text/javascript" >/JS replication feature supports for Ie/firefox/mozilla/ns function Copy_clip ( Meintext) {if (window.clipboarddata) {window.clipboardData.setData ("Text", Meintext); else if (window.netscape) {netscape.security.PrivilegeManager.enablePrivilege (' universalxpconnect '); 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.interfa ces.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.nsIS upportsstring); var Copytext=meintext; 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 ("Copy the information below to the Clipboard: \ n" + meintext); return false; } function CopyToClipboard (TXT) {if (window.clipboarddata) {window.clipboardData.clearData (); Window.clipboardData.setData ("Text", txt); else if (navigator.userAgent.indexOf ("Opera")!=-1) {window.location = txt; else if (Window.netscape) {try {netscape.security.PrivilegeManager.enablePrivilege ("Univers Alxpconnect "); catch (E) {alert ("You use the FF browser, the copy function is rejected by the browser!") \ nplease type ' About:config ' in the browser address bar and enter \ n then set ' Signed.applets.codebase_principal_support ' to ' true '); var clip = components.classes[' @mozilla. Org/widget/clipboard;1 '].createinstance (Components.interfaces.nsIClip Board); 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 = txt; 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); } var o= "JS replication feature support for Ie/firefox/mozilla/ns"; Alert ("The first way to copy the content is as follows: \ n" +o); Copy_clip (o); Alert ("The second way to copy the content is as follows: \ n" +o); CopyToClipboard (o); Alert ("Both tests, you look at the effect, find a place to paste it!" or write a Web page of their own to test the function! "); </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]