Click to See Complete Forum and Search --> : Copying the contents of an i-frame


jovialjonny
06-17-2003, 04:24 PM
hi,
I have got an iframe that is being targeted by a form. So the form submits to a servlet and the resulting page loads in this iframe.

What I want to do is create another iframe containing exactly the same thing (So the data in the form can be analysed by users in a split screen). I have had no problem duplicating the iframe for regular web pages like so:

var ifrm = document.createElement("IFRAME");
ifrm.id = "f"+reverseId;
ifrm.scrolling = "Auto";
//THE FRAME I AM COPYING
var origIfrm = document.getElementById("f"+tabId);
//SET THE SRC TO BE THE SAME
ifrm.src = origIfrm.src;
document.body.appendChild(ifrm);

If the iframe contained, say google, this works fine but when I try it with the data returned from the form I just get a blank page.

The iframe containing the form seems to have no 'src' or 'location' or 'innerHTML' that I can reference. Does anyone know how can I get the content of the iframe and put it into this new iframe I have created?

Khalid Ali
06-17-2003, 05:40 PM
Post a link...
If the servlet returning values is served fromt he same server where your pages are then thene should be no problem

jovialjonny
06-18-2003, 08:37 AM
I can't post a link because I only have intranet access right now but I am holding all my files...the HTML, JavaScript and Servlet class files in the same directory on my local machine which is using a Microsoft IIS server.

I don't really know too much about servers to be honest because I'm a bit of a newbie but you think that by just setting the 'src' attribute of the new frame to be the same as the old that should work?

Khalid Ali
06-18-2003, 09:09 AM
Originally posted by jovialjonny
[B]my local machine which is using a Microsoft IIS server.
/B]

Haen....?????

Since when IIS supports servlet...??? or have I been asleep for last several years ..:D

jovialjonny
06-18-2003, 01:02 PM
Originally posted by Khalid Ali
Haen....?????

Since when IIS supports servlet...??? or have I been asleep for last several years ..:D

Im using JRun 4 to run the servlets, I have it configured to work with IIS. To be honest I didn't do it myself so I'm unsure what the exact setup is but they do run on the same server as far as I am aware. Have you any idea what could be wrong? The 'src' and 'innerHTML' are empty and the 'location' comes back as undefined so I am running out of ideas for getting the content to display in the new frame.

Khalid Ali
06-18-2003, 05:45 PM
Oh ok..I know JRun can be configured with an array of http webservers..

Ok when this page comes back from the servlet,can you view the src?

jovialjonny
06-19-2003, 08:52 AM
No I can't view the'src', if I put an alert on it it comes up blank, I tried setting the location to be the same (newFrame.location = oldFrame.location) and a few other things but have had no luck as yet.