IE and firefox general JS function copy to clipboard

sponsored links
1.function copyToClipboard (txt) (
2. If (window.clipboardData) (
3. Window.clipboardData.clearData ();
4. Window.clipboardData.setData ("Text", txt);
5.) Else if (navigator.userAgent.indexOf ("Opera")! = -1) (
6. Window.location = txt;
7.) Else if (window.netscape) (
8. Try (
9. ("UniversalXPConnect");
10.) Catch (e) (
11. Alert ("is your browser to refuse! \ N in the browser address bar enter 'about: config' and carriage return \ n then 'signed.applets.codebase_principal_support' set to 'true'");
13. Var clip = Components.classes ['@ / widget / clipboard; 1']. CreateInstance (Components.interfaces.nsIClipboard);
14. If (! Clip)
15. Return;
16. Var trans = Components.classes ['@ / widget / transferable; 1']. CreateInstance (Components.interfaces.nsITransferable);
17. If (! Trans)
18. Return;
19. Trans.addDataFlavor ('text / unicode');
20. Var str = new Object ();
21. Var len = new Object ();
22. Var str = Components.classes ["@ / supports-string; 1"]. CreateInstance (Components.interfaces.nsISupportsString);
23. Var copytext = txt;
24. = copytext;
25. Trans.setTransferData ("text / unicode", str, copytext.length * 2);
26. Var clipid = Components.interfaces.nsIClipboard;
27. If (! Clip)
28. Return false;
29. Clip.setData (trans, null, clipid.kGlobalClipboard);
30. Alert ("Copy succeeded!")
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of IE and firefox general JS function copy to clipboard

  • Play flash page 3 (javascript script swfobject.js1)

    / ** * SWFObject v1.5: Flash Player detection and embed - * * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License: * Http:// * * / if (typeof deconc ...

  • Read "prototype.js 1.4 Developer Edition Manual" excerpt

    Information Address: Extract 1, $ F () function Function: Return of any form input control value, the parameters are the element id or the element itself Example: <script

  • Wait for prompt js General category

    This is a very easy-to-use widget, the parameters have default values, default values, see the Notes wait = new WaitingTip();'id')); //Parameter 1 is displayed, in reference to the object ... wait.hide(); //Hide The use

  • javascript built-in functions Info

    48. In the old browsers do not perform this JS :<!-- //--> 49. To quote a document-style JS: <script type="text/javascript" src="/blog/aaa.js"> </ script> 50. Specified in the script does not support the browser displ

  • SUI-JavaScript rich UI library integration solution

    Introduction: SUI is not a class implementation of the UI, nor is it a standard set of UI markup language, it is just to help the existing UI frameworks (such as Ext, YUI like) to mark the way to the statement and the creation of UI. The names of these ta

  • extjs development environment set up and practice

    1, download and extract the extjs 2, download eclipse and Eclipse AJAX Toolkit Framework (ATF) I have been accustomed to using eclipse as a development environment, a variety of open-source plugin so that eclipse has all-around performance, operating effi

  • Msxml2.XMLHTTP version problem

    Projects with an import feature prototype.js of Ajax functionality to update the prompt, the code is very simple, do not have the framework of the background on a jsp to output Text, future use of timers and to update the page Ajax.request encountere ...

  • JS after ajax request return of the problem can not be implemented

    1: Send ajax request, in the onComplete, if back when the html contains a javascript, then these javascrip and will not be realized, it does not mean not to implement. This problem has troubled me for a long time, behind the hair and then put this kn ...

  • Use Ext JS to read the JsonReader complex object json

    Today was how to resolve the following complex json object to the difficult living over a long time .. did not find documentation how to read JsonReader Ways json object (possibly also because of their limited level of E the text did not correctly underst

  • Process migration from tomcat to websphere changes

    Process migration from tomcat to websphere changes Because customers use the web application server software used by different what tomcat5, tomcat6, websphere5.1, websphere6.1, weblogic8, and so on, and the software used inconsistent standards, ibm's

blog comments powered by Disqus
Recent Entries
Tag Cloud
Random Entries