473,387 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

[JavaScript]How to "auto" copy content of textbox to clipboard

121 100+
I am doing a ASP.NET porject, inside a asp control tag there are some textboxes for users to input data.

Later they can take previously entered data out of those textboxes.

To provide better UI efficiency, I would like to use JavaScripts to support "auto" copy to clipboard, but I don't know how to achieve that?

Here is my code stub:
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.     var input = document.getElementById("<%=txtUser.ClientID%>").text;
  3.     function autocopy(input)
  4.     {
  5.         //it should pass input to windows clipboard, or any program
  6.         // that can support the "ctrl+V" feature...
  7.     }
  8. </script>
I am quite a noob at javascript, so I really have no idea how to continue.

Thanks in advance!
Apr 3 '08 #1
1 3073
acoder
16,027 Expert Mod 8TB
In IE, you can use something like:
Expand|Select|Wrap|Line Numbers
  1. window.clipboardData.setData("text",...);
In Firefox, you will need to sign the script or allow it to run - see link. I'm not sure about other browsers.
Apr 3 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Tarken | last post by:
Hi, I am trying to do some refactoring of a web site to ensure that it displays in the most web clients possible. One of the pages requires to be redirected to another automatically, for one...
2
by: Vern | last post by:
Hi All, I'm looking for a script which monitors each keystroke in an input text field and compares it to the contents of an array of strings and displays the first matching element as the user...
1
by: Koman \( Hong Kong \) | last post by:
Dear Experts, I want to capture the text to the clipbroad when i use the mouse left clicking on such text.. ( i want to simplify the step of "Highlight Text" > "Mouse Right Click" > "Copy")...
5
by: nivas.meda | last post by:
Hi, I have an excel sheet with a graph and cells.If i change the value in the excel cells the graph will reflect.Now i am going to implement this functionality in html page.I successfully saved...
16
by: rodchar | last post by:
hey all, you know when you log in to msdn and go to subscription downloads, the header of the page is fixed and the body of the page scrolls, is that done with frames? thanks, rodchar
2
by: Jim Carr | last post by:
Upon entering the site www.FutureByDesign-Music.com with IE6, my clipboard is erased and then disabled in all other Windows XP applications. Navigating to another site returns clipboard...
1
by: Raffi | last post by:
Hi, I have an application screen with a CSS scroll area. Users click links in the scroll area which open small popup windows to enter data. When the data is submitted, the popup reloads the...
2
by: Piotr K | last post by:
Hi, I've encountered a strange problem with Firefox which I don't have any idea how to resolve. To the point: I've <divelement with a style "height: auto" and I want to retrieve this value...
26
by: Jake Barnes | last post by:
I did a search on the newsgroup comp.lang.javascript. I was searching for "how to play a sound with Javascript". I'm somewhat suprised that the majority of entries are from the 1990s, and there are...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.