Completely copy the content of one frame to another..

T

tedqn

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 frame
for other things. When done, the user then can pull back the previous
page into the main frame. I tried the swapping with
document.body.innerHTML but then it only copied whatever in the body
but not the header, which contains all the javascript functions and
css. I thought about just replacing the other frame's url with the
current but it won't work because the current page contains a "form
submitted" search & result. Loading its url to the other frame would
result in a complete new search. Any ideas appreciated.
 
R

Ron

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 frame
for other things. When done, the user then can pull back the previous
page into the main frame. I tried the swapping with
document.body.innerHTML but then it only copied whatever in the body
but not the header, which contains all the javascript functions and
css. I thought about just replacing the other frame's url with the
current but it won't work because the current page contains a "form
submitted" search & result. Loading its url to the other frame would
result in a complete new search. Any ideas appreciated.
Heya ted,
Try :

if(document.implementation.hasFeature("Core", "2.0")) {
var myHTMLElement = parent.myFrame.document.documentElement;
myHTMLElement =
parent.myOtherFrame.document.importNode(myHTMLElement, true);
parent.myOtherFrame.document.replaceChild(myHTMLElement,
parent.myOtherFrame.document.documentElement);
}
else {
alert("Can't transfer search results. :(");
}

I've never tried this before so it may need some tweaking. Let me know
if it works.
More Core interfaces can be found here->
http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html .
 
T

tedqn

hi it didn't work. I use IE 6 and it fails mainly because the
importNode
function doesn't exist. I tried the cloneNode too and various changes
but it just wouldn't work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top