473,320 Members | 1,978 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,320 software developers and data experts.

Copy and Paste form in another frame

Hi all,

I am trying to copy a form that is in one frame, using a button on another
frame. The form has a couple of tables inside it. I can get it working
when the button is in the same frame, but not in different ones. I get an
"invalid argument" error on the controlRange.addElement(x) line.

What I have so far is:

<script language='javascript'>
function CopyForm() {
if (document.body.createControlRange) {
var x = window.parent.fraRight.document.getElementById('Fo rm1');
x.contentEditable = 'true';
var controlRange;
controlRange = document.body.createControlRange();
controlRange.addElement(x);
controlRange.execCommand("Copy");
x.contentEditable = 'false';
alert('The table is now copied to memory. \nStart Excel, and Paste
the table into a new worksheet.');
}
</Script>

where fraRight is the name of the frame the form is in, and Form1 is the
name of the form I want to copy. The only thing I have changed from when it
was working in the one frame, is:
var x = window.parent.fraRight.document.getElementById('Fo rm1');
used to be
var x = document.getElementById('Form1');

I can do things like alert(x.name) and get the right name of the form, so I
think I have got the object properly. Is there any other way to make sure?

Any help appreciated.

Thanks,

Bob T


Jul 23 '05 #1
1 2199
In article <41********@clear.net.nz>, bo*********@yahoo.com says...

I can do things like alert(x.name) and get the right name of the form, so I
think I have got the object properly. Is there any other way to make sure?

Any help appreciated.


What you seem to be trying to do is an IE-only feature - copying
"Form1" to the clipboard, then pasting it into another application.
Consider using a different method to select the things to copy, then
let the user Ctrl+C or click on "copy" to make your code compatible
with other browsers.

At the very least, do feature detection and warn users if
"execCommand" isn't supported by their choice of user agent.

Cheers, Rob.
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bob T Bunny | last post by:
Hi all, I am trying to copy a form that is in one frame, using a button on another frame. The form has a couple of tables inside it. I can get it working when the button is in the same frame,...
3
by: cv | last post by:
Hi all, I have to copy two set of data from 2 files(notepad/excel) say, products and their corresponding prices to list/textarea/table. I should be able to retrieve the product and corresponding...
2
by: tedqn | last post by:
This may sound weird but I'm try to find a way to copy the whole docoument from one frame to another. It's sort of like stowing away the whole page to another frame so that user can use the main...
5
by: NK | last post by:
Hi, We have a webpage that has a form available on the intranet. A user will have a window open that runs a different application open. When the user accesses the webpage and clicks a button we...
2
by: Greg | last post by:
Hi all, Is there a way to copy multiple objects into the clipboard and then paste them? What I want to achive is to be able to copy UI controls (textedits, dropdowns, etc) from one form and...
6
by: NuB | last post by:
I have a winform and a menu on the form, It allows the users to copy and paste text from text boxes. I never had to do this before, how can I copy and paste text from one box to another?
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
9
by: =?Utf-8?B?VGVycnk=?= | last post by:
Hi, Is it possible (w/o generating a gazillion errors) to copy a form in VS 2005 so that it can be modified and reused. In other words, I have a form, alot of which I wish to use in a different...
5
by: mbatestblrock | last post by:
I was wondering if it were possible to do this. I have a form that is used to input a ton of information and then I have a button on it it to export it into a word template to print out. Now I...
5
by: phill86 | last post by:
Hi I have a main form that holds records for scheduled meetings, date time location etc... in that form i have a sub form that has a list of equipment resources that you can assign to the meeting in...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.