Click JS for the copied text. Looking for a long time, because has not been contacted before, completely do not know the compatible IE and standard Dom browser, not only through JS, but also need flash help. Clipboard.swf This is downloaded on the Internet.
IE allows access to the Clipboard. Window.clipboarddata can access
But the standard DOM. Read some articles are said to be hidden with the flash settings. But FLASH10 is not supported.
However, there is a way to do it, solid record, the following methods to support the standard DOM.
Copy Code code as follows:
(function () {
window[' Util '] = {
cache:{},
Gettext:function () {
return Util.CACHE.CLIPBOARD_TEXT;
},
Successhide:function () {
Alert ("Copy the North Sea 365 network recruitment email address!");
},
Copy:function (Pstr,hasreturn, ISDO) {
var html = [];
Html.push (' <object type= ' Application/x-shockwave-flash "Data=" clipboard.swf?gettext=util.gettext&success= Util.successhide "width=" "height=" "style=" position:relative;top:11px;left:-50px; "id=" ff_clipboard_swf ">" );
Html.push (' <param name= "quality" value= "High"/> ");
Html.push (' <param name= "allowscriptaccess" value= "Samedomain"/> ");
Html.push (' <param name= "allowfullscreen" value= "true"/> ");
Html.push (' <param name= "wmode" value= "Transparent"/> ");
Html.push (' </object> ');
var Yu=document.getelementbyid (' Copy '). InnerHTML;
document.getElementById (' Copy '). Innerhtml=yu+html.join (');
Util.CACHE.CLIPBOARD_TEXT = pstr;
}
}
Util.copy (' zhaopin@beihai365.com ');
})();
If you want to be compatible with IE. You have to add
Copy Code code as follows:
if (window.clipboarddata) {
Window.clipboardData.setData ("Text", pstr);
Util.successhide ();
}
This finally enables you to click the copied text and to be compatible with each browser. Remember. The path of the SWF must be right! If the wrong is not to appear hand-shaped, this is characteristic.
Copy Code code as follows:
(function () {
window[' Util '] = {
cache:{},
Gettext:function () {
return Util.CACHE.CLIPBOARD_TEXT;
},
Successhide:function () {
Alert ("Copy the North Sea 365 network recruitment email address!");
},
Copy:function (Pstr,hasreturn, ISDO) {
var Copy=document.getelementbyid (' Copy ');
if (window.clipboarddata) {
Copy.onclick=function () {
Window.clipboardData.setData ("Text", pstr);
Util.successhide ();
}
} else {
var html = [];
Html.push (' <object type= ' Application/x-shockwave-flash "Data=" clipboard.swf?gettext=util.gettext&success= Util.successhide "width=" "height=" "style=" position:relative;top:11px;left:-50px; "id=" ff_clipboard_swf ">" );
Html.push (' <param name= "quality" value= "High"/> ");
Html.push (' <param name= "allowscriptaccess" value= "Samedomain"/> ");
Html.push (' <param name= "allowfullscreen" value= "true"/> ");
Html.push (' <param name= "wmode" value= "Transparent"/> ");
Html.push (' </object> ');
var yu=copy.innerhtml;
Copy.innerhtml=yu+html.join (");
Util.CACHE.CLIPBOARD_TEXT = pstr;
}
}
}
Util.copy (' zhaopin@beihai365.com ');
})();