复制代码 代码如下: <!--<BR>function copyToClipboard(meintext)<BR>{<BR> //ie<BR> if (window.clipboardData){<BR> window.clipboardData.setData("Text", meintext);<BR> }<BR> else if (window.netscape)<BR> {<BR> try<BR> {<BR> netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");<BR> }<BR> catch(e)<BR> {<BR> alert("被浏览器拒绝!"); ///n请在浏览器地址栏输入'about:config'并回车/n然后将 'signed.applets.codebase_principal_support'设置为'true'<BR> }<BR> var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);<BR> if (!clip) return;<BR> var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);<BR> if (!trans) return;<BR> trans.addDataFlavor('text/unicode');<BR> var str = new Object();<BR> var len = new Object();<BR> var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);<BR> var copytext=meintext;<BR> str.data=copytext;<BR> trans.setTransferData("text/unicode",str,copytext.length*2);<BR> var clipid=Components.interfaces.nsIClipboard;<BR> if (!clip) return false;<BR> clip.setData(trans,null,clipid.kGlobalClipboard);<BR> }<BR> alert("已复制本页链接,您可以使用Ctrl+V粘贴后,发送给好友!");<BR> return false;<BR>}<BR>// --> 调用copyToClipboard(meintext);meintext为传入参数。01集