473,625 Members | 2,662 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

121 New Member
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 3087
acoder
16,027 Recognized Expert Moderator MVP
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
10810
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 reason or another. My style is usually to reduce the use of Javascript, as much as possible, as in my experience it often causes compatibility issues. Anyhow, the page currently has: ....
2
1650
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 types. In other words, something which works very much like the Windows "Autocomplete" feature. Has someone invented this wheel? Thanks.
1
1711
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") Can i use javascript to do this? I found some hints about this from internet: ==============================================
5
2917
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 this as interactive html page.Now my requirement changes a bit.The excell cells will not visible to others.i have a text box,If i change the value in text box the excel template cell value need to change. I did the follwing steps for creating...
16
2270
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
2880
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 functionality, but whatever was on the clipboard before is lost. If I disable running JavaScript on the page, the clipboard is unaffected. Viewing the page in Firefox does not have this issue. I think it might be the script below, which makes no sense...
1
3805
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 opener to update the page and closes itself. However when the parent page is updated, the div scrolls back to the top. Is there a way to have CSS remember the vertical scroll position and go back to it when the page is reloaded? Similar to...
2
3063
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 ("auto") in JavaScript - however instead of getting "auto" value, I get calculated height. In IE and Opera it simply returns "auto". Any ideas how to check in Firefox if element height was set to "auto" ? I'll be grateful for any help.
26
3879
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 almost no posts from the last 3 years: http://groups.google.com/group/comp.lang.javascript/search?group=comp.lang.javascript&q=how+to+play+a+sound+with+Javascript&qt_g=Search+this+group Even after sorting by date, there don't appear any...
0
8688
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8494
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7178
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6115
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4085
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4188
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2614
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1496
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.