js复制文本到剪贴板
1.该js 暂时只能兼容ie浏览器
var Fe = Fe || { version: "20080809", emptyFn: function () { } }; Fe.G = function () { for (var b = [], c = arguments.length - 1; c > -1; c--) { var d = arguments[c]; b[c] = null; if (typeof d == "object" && d && d.dom) { b[c] = d.dom } else { if ((typeof d == "object" && d && d.tagName) || d == window || d == document) { b[c] = d } else { if (typeof d == "string" && (d = document.getElementById(d))) { b[c] = d } } } } return b.length < 2 ? b[0] : b }; Fe.copy = function (b) { var a = Fe.copy._node; if (!a) { a = Fe.copy._node = document.createElement("DIV"); a.style.position = "absolute"; a.style.top = "-1000px"; a.style.left = "-1000px"; document.body.appendChild(a) } a.innerHTML = ["<embed ", 'src="/Content/images/map/clipboard.swf" ', 'FlashVars="clipboard=', encodeURIComponent(String(b)), '" ', 'width="0" ', 'height="0" ', 'type="application/x-shockwave-flash"></embed>'].join("") }; function copy() { var c = Fe.G("UserName"); var b = c.value; if (!b) { return } if (window.clipboardData) { window.clipboardData.clearData(); window.clipboardData.setData("Text", b); if (Fe.G("copyMessage")) { Fe.G("copyMessage").style.display = "" } setTimeout(function () { if (Fe.G("copyMessage")) { Fe.G("copyMessage").style.display = "none" } }, 1000) } else { try { Fe.copy(b); if (Fe.G("copyMessage")) { Fe.G("copyMessage").style.display = "" } setTimeout(function () { if (Fe.G("copyMessage")) { Fe.G("copyMessage").style.display = "none" } }, 1000); return b } catch (a) { } } }

浙公网安备 33010602011771号