473,789 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do you copy an iframe's content to another iframe?

1 New Member
I'm trying to copy information in one iframe to another iframe with javascript. I am using firefox and information from my local domain so there are no security issues. However I'm just not getting it. Somebody please give me some help here, perhaps show me the right tag names. I'm tired of trial and error guessing. Are there any good books that deal with firefox, iframes, javascript, and asynchronous AJAX?

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  3. "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" >
  6.     <head>
  7.       <title>Test1</title>
  8.       <meta name="revision" content="$Id: $" />
  9.       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  10.       <meta name="keywords" content=""/>
  11.       <meta name="description" content=""/>
  12.       <link rel="stylesheet" type="text/css" href="/local-stylesheet.css"/>
  13.         <script>
  14.             function copy_frame(argFrm1, argFrm2) {
  15.                 //window.frames["ifrm2"].document.body.innerHTML = "<p>hello</p>"; // works, frame has hello
  16.                 //window.document.body.innerHTML = "<p>hello</p>"; // works, replaces document with hello.
  17.                 window.document.body = window.frames["ifrm1"].document.body;  // this works!
  18.                 //window.frames["ifrm2"].document.body = window.frames["ifrm1"].document.body;  // This causes both to go blank.
  19.             }
  20.         </script>
  21.     </head>
  22.  
  23.     <body>
  24.         <div id="insert"></div>
  25.  
  26.       <div id="div4frm1">
  27.           <iframe name="ifrm1" id="ifrm1" src="http://www.local.com" >
  28.                 use firefox
  29.             </iframe>
  30.       </div>
  31.  
  32.       <div id="div4frm2">
  33.           <iframe name="ifrm2" id="ifrm2" src="" >
  34.                 Get firefox
  35.             </iframe>
  36.         </div>
  37.  
  38.         <div id="move">
  39.             <INPUT TYPE="button" onClick="copy_frame(ifrm1, ifrm1);" value="copy" ID="b">
  40.         </div>
  41.     </body>
  42. </html>
Sep 28 '06 #1
1 17641
acoder
16,027 Recognized Expert Moderator MVP
Replace
Expand|Select|Wrap|Line Numbers
  1. //window.frames["ifrm2"].document.body = window.frames["ifrm1"].document.body;  // This causes both to go blank.
with
Expand|Select|Wrap|Line Numbers
  1. frames["ifrm2"].document.body.innerHTML=
  2. frames["ifrm1"].document.body.innerHTML;
May 17 '08 #2

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

Similar topics

1
1901
by: James Wallace | last post by:
I need to know how to change the src property of an iframe from script that is executed in another iframe with both of these iframes being contained on a document which is then contained by another frame. I have done a bunch of searching on these groups all to no avail. I am new to javascript and learning so if someone can help me with this I would appreciate it.
3
9517
by: Paul | last post by:
HI! how do we load a page from the menu into an iframe when you are not on the iframe page? I want to be able to load pages (options in my menu ) into a iframe no matter if I am on the iframe page or not. how do we do this. Right I have two menu's because I dont know how to do this. one for other pages that dont have the iframe in question and another for the
6
4961
by: SF RVN | last post by:
I have searched NUMEROUS sources in an effort to find the magic (script, styles, syntax, etc.) that will allow me to create a web page with the following format: |----------------------------------------------------------------| | Discrete table used as 'banner' | | DONE! | |----------------------------Table 1-----------------------------| ...
3
11928
by: karthickdevi | last post by:
Hi, I have an iframe , say 'iframe01' in my parent document. In the same parent document, i have a div tag and inside the div tag, i have another iframe, say 'iframe02'. Now i want to access the iframe01 element from the iframe02. Please suggest me how can i do it. I have tried the following, but i get as undefined.
1
2590
by: pb | last post by:
Hi, I have as asp.net 2 web page that has an iframe. The content of this frame is a 2nd web page that contains a load of javascript. You play around with this 2nd web page to define certain things. What I need to do is to somehow scan the content of this embedded web page to extract data settings that can then be used in the code behind the ASP page. Is this possible, and if so, any pointers please on where to start.
1
3690
by: dolittle | last post by:
Hi, I'm using an iframe in my page. When the user click on a link in the iframe the transition to the new page is not as smooth as if the page was stand alone. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>iframe</title>
1
1390
by: malathib | last post by:
Hi, i am having a text editor which uses iframe. Here if the user is trying to paste some text into the iframe, how i can restrict the user not to do that. in the same manner, i don't want the user to delete the content from iframe directly. if the user is trying to do that, it has to alert the user.
0
9663
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10136
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9979
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
9016
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
7525
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
6765
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4090
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
3
2906
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.