rush:js;">
2.复制专题地址和 url 地址,传给 QQ/MSN 上的好友
rush:js;">
Js
URL地址,传给QQ/MSN上的好友">
3.直接复制 url
rush:js;">
URL地址">
rush:js;">
rush:js;">
7.浏览器兼容 copyToClipboard("拷贝内容")
rush:js;">
function copyToClipboard(txt) {
if (window.clipboardData) {
window.clipboardData.clearData();
clipboardData.setData("Text",txt);
alert("复制成功!");
} else if (navigator.userAgent.indexOf("Opera") != -1) {
window.location = txt;
} else if (window.<a href="https://www.jb51.cc/tag/netscape/" target="_blank" class="keywords">netscape</a>) {
try {
<a href="https://www.jb51.cc/tag/netscape/" target="_blank" class="keywords">netscape</a>.s<a href="https://www.jb51.cc/tag/ecurity/" target="_blank" class="keywords">ecurity</a>.PrivilegeManager.enablePrivilege("Universal<a href="https://www.jb51.cc/tag/xpc/" target="_blank" class="keywords">xpc</a>onnect");
} catch (e) {
alert("被浏览器拒绝!\n请在浏览器地址栏输入'about:con<a href="https://www.jb51.cc/tag/fig/" target="_blank" class="keywords">fig</a>'并回车\n然后将 'signed.applets.codebase_principal_support'设置为'true'");
}
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.nsISupport<a href="https://www.jb51.cc/tag/sst/" target="_blank" class="keywords">sst</a>ring);
var <a href="https://www.jb51.cc/tag/cop/" target="_blank" class="keywords">cop</a>ytext = txt;
str.data = <a href="https://www.jb51.cc/tag/cop/" target="_blank" class="keywords">cop</a>ytext;
trans.setTransferData("text/unicode",str,<a href="https://www.jb51.cc/tag/cop/" target="_blank" class="keywords">cop</a>ytext.length * 2);
var clipid = Components.interfaces.nsIClipboard;
if (!clip)
return false;
clip.setData(trans,null,clipid.kGlobalClipboard);
alert("复制成功!");
}
}</pre>