473,466 Members | 1,374 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

window.clipboardData.setData

2 New Member
Hi,
I am new to Javascript and have just taken over the maintenance of some code written by another developer (who has left the company). His code is properly copying same data and placing it on the windows clip board. My task is to make this data be copied in a format that will paste nicely into Excel.

Here is the current code for the function.
Any suggestions would be appreciated.
Thanks.


function CopyToClipboard()
{
var obj, box;

obj = null;
if (document.getElementById)
obj = document.getElementById('cmt');
if (obj)
{
box = document.getElementById('parts');
partNo = box.options[box.selectedIndex].text;
data = "";
data = data + "Catalog Number: " + partNo;
data = data + "\r\nDescription: " + document.getElementById('description').innerText;
data = data + "\r\nQuantity to order: " + document.getElementById('qty').value;
data = data + "\r\n";

window.clipboardData.setData('Text', data);
window.status = "Catalog number, price, and quantity copied to clipboard";
}
}
Jun 20 '07 #1
2 17369
iam_clint
1,208 Recognized Expert Top Contributor
Expand|Select|Wrap|Line Numbers
  1. data = "";
  2. data = data + "Catalog Number: \t" + partNo;
  3. data = data + "\r\nDescription: \t" + document.getElementById('description').innerText;
  4. data = data + "\r\nQuantity to order: \t" + document.getElementById('qty').value;
  5. data = data + "\r\n";
  6.  
try that out
Jun 20 '07 #2
vtforme
2 New Member
Expand|Select|Wrap|Line Numbers
  1. data = "";
  2. data = data + "Catalog Number: \t" + partNo;
  3. data = data + "\r\nDescription: \t" + document.getElementById('description').innerText;
  4. data = data + "\r\nQuantity to order: \t" + document.getElementById('qty').value;
  5. data = data + "\r\n";
  6.  
try that out

WOW that was quick. I'm glad I stumbled upon this web site. I was getting nowhere on the MSDN site.
That works great.
Thanks again.
Jun 20 '07 #3

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

Similar topics

1
by: Curzio Basso | last post by:
Hi all, I have a problem for which I wasn't able to find an answer anywhere else, maybe someone can give me a hint... I designed with XRCed a small GUI (the code is at the bottom of the...
5
by: Carol Lyn | last post by:
Could use your assistance with this. I have a window that opens via onclick and it is a small window with info about a site. If the user is interested in visiting that site, there is a link to...
2
by: Juan Garcia | last post by:
Subject says it all. Given: Window A with text field. Window B with a button (onClick opens Window C) Window C with a button (onClick I want it to modify text fields of Window A) I have...
1
by: amith | last post by:
Hi, I have a javascript, calendar.js which i use to enable my client to select the date. This calendar pops up on the click of a gif image. But the problem is that this poped up window is not...
8
by: Renuka | last post by:
I have a confirmation page with an OK button. If this window has an opener then this browser window needs to go to another URL or else the window must close. Thus I have the following javascript...
26
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized...
4
by: alexandre.brisebois | last post by:
Hi, I am using access 2003, I would like to know if there is an option to reorganize the tables in a maner that is readable, as we can do in sql sever 2000 or 2005. I have been given a database...
4
by: dwhalen | last post by:
Hi Everyone. I'm new to drag-and-drop, and I'm running into a problem getting some code I found to work in FireFox. I have a third-party Tree control that accepts droppable items that implement...
0
by: apple27 | last post by:
Hi, Appreciate your guys help.. Im a newbie in OWC.Trying to search for OWC objects to complete a few charts. Still having difficulty on this :- My questions: 1. I need to come out with a...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.