473,386 Members | 1,823 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,386 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 tell?

Any help appreciated.

Thanks,

Bob T
Jul 17 '05 #1
2 4992
Bob T Bunny wrote:
:: 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 tell?
::
:: Any help appreciated.
::
:: Thanks,
::
:: Bob T

--
This is a Java newsgroup not to be confused with javascript. Try posting
to:

comp.lang.java.javascript
comp.lang.javaxcript

Thanks in Advance...
IchBin
__________________________________________________ ________________________

'Laughter is inner jogging'
- Norman Cousins, editor and author (1915-1990)
Jul 17 '05 #2
Oops. Thanks for that.

Bob T

"IchBin" <we***********@pdt.net> wrote in message
news:_o********************@ptd.net...
Bob T Bunny wrote:
:: 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) { ....
.... ::
:: Thanks,
::
:: Bob T

--
This is a Java newsgroup not to be confused with javascript. Try posting
to:

comp.lang.java.javascript
comp.lang.javaxcript

Thanks in Advance...
IchBin
__________________________________________________ ________________________

'Laughter is inner jogging'
- Norman Cousins, editor and author (1915-1990)

Jul 17 '05 #3

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

Similar topics

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...
1
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,...
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
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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
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...

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.