Connecting Tech Pros Worldwide Forums | Help | Site Map

Completely copy the content of one frame to another..

tedqn@yahoo.com
Guest
 
Posts: n/a
#1: Jul 23 '05
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.

Ron
Guest
 
Posts: n/a
#2: Jul 23 '05

re: Completely copy the content of one frame to another..


tedqn@yahoo.com wrote:
[color=blue]
>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.
>
>[/color]
Heya ted,
Try :

if(document.implementation.hasFeature("Core", "2.0")) {
var myHTMLElement = parent.myFrame.document.documentElement;
myHTMLElement =
parent.myOtherFrame.document.importNode(myHTMLElem ent, true);
parent.myOtherFrame.document.replaceChild(myHTMLEl ement,
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-Le...1113/core.html .
tedqn@yahoo.com
Guest
 
Posts: n/a
#3: Jul 23 '05

re: Completely copy the content of one frame to another..


Ron <webmaster@slider142.com> wrote in message news:<BGVlc.129570$Gd3.31359519@news4.srv.hcvlny.c v.net>...

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.
[color=blue]
> Heya ted,
> Try :
>
> if(document.implementation.hasFeature("Core", "2.0")) {
> var myHTMLElement = parent.myFrame.document.documentElement;
> myHTMLElement =
> parent.myOtherFrame.document.importNode(myHTMLElem ent, true);
> parent.myOtherFrame.document.replaceChild(myHTMLEl ement,
> 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-Le...1113/core.html .[/color]
Closed Thread