方案一:利用“window.clipboardData”
代码示例:
if (window.clipboardData) {
window.clipboardData.clearData();
window.clipboardData.setData("Text", txt)
};
问题:这个方案只对IE浏览器适用。
方案二:利用“Components.interfaces.nsIClipboard”
代码示例:
if (window.netscape) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
} catch (e) {
if (flag == 0) {
alert("You are using the Firefox browser, copy the function browser refuse!
\nPlease in the browser address bar enter'about:config' and Enter \n and set'signed.applets.codebase_principal_support' to 'true'");
} else {
alert("你使用的是Firefox 浏览器,复制功能被浏览器拒绝!\n请在浏览器地址栏输入'about:config'
并回车\n然后将'si