Reply
Sat 20 Nov, 2004 01:44 pm
Hi All
I am new to thsi group
Using javascript in IE 5.5 + I need to press a button and copy all the form field data to the clipboard.
I think that the form field data (Multiple fields) must forst be copied to a string, then the string copied to the clipboard??
Can someone please show me how to acheive this?
Thanks in Advance
Ed
Re: how do I copy Multiple Form Field data to the Clipboard
EdHannan wrote:I think that the form field data (Multiple fields) must forst be copied to a string, then the string copied to the clipboard??
Sound about right.
Unfortunately I can't write the script for you at this time.
String to clipboard
Craven
thanks for your reply and have a good break.
I am still learning javascript and have been able to copy the data from one form field to the clipboard but having a little trouble getting it all in to a string:(
Hope you can point me in the right direction at your convenience
Thanks very much
Ed
Hre is my function code to copy one element on a form
function clipboard()
{
var oElement = document.getElementById("refnum");//get the refnum ID
oElement.createTextRange().execCommand("Copy");//copy the contents to the windows clipboard
}
This works ok, but mulltiple elements dont work, I have tried assiging different elements to a string then concatenating..but I get errors, here is my code for this.
function clipboard()// multiple elements
{
var tempstore = "";
var therange;
var tempref = document.getElementById("refnum");//get the refnum ID
var tempamount = document.getElementById("amount");
tempstore = tempref + tempamount;// concatenate strings
//tempstore.createTextRange().execCommand("Copy");//copy the contents to the windows clipboard
therange=tempstore.createTextRange();
therange.execCommand("Copy");
Can anyone shed any light on where I am going wrong here
Cheers
Ed