Connecting Tech Pros Worldwide Help | Site Map

Completely copy the content of one frame to another..

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 23rd, 2005, 10:43 AM
tedqn@yahoo.com
Guest
 
Posts: n/a
Default Completely copy the content of one frame to another..

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.

  #2  
Old July 23rd, 2005, 10:43 AM
Ron
Guest
 
Posts: n/a
Default 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 .
  #3  
Old July 23rd, 2005, 10:44 AM
tedqn@yahoo.com
Guest
 
Posts: n/a
Default 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]
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.