Completely copy the content of one frame to another..

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tedqn@yahoo.com

    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.i nnerHTML 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

    #2
    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.imp lementation.has Feature("Core", "2.0")) {
    var myHTMLElement = parent.myFrame. document.docume ntElement;
    myHTMLElement =
    parent.myOtherF rame.document.i mportNode(myHTM LElement, true);
    parent.myOtherF rame.document.r eplaceChild(myH TMLElement,
    parent.myOtherF rame.document.d ocumentElement) ;
    }
    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 .

    Comment

    • tedqn@yahoo.com

      #3
      Re: Completely copy the content of one frame to another..

      Ron <webmaster@slid er142.com> wrote in message news:<BGVlc.129 570$Gd3.3135951 9@news4.srv.hcv lny.cv.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.imp lementation.has Feature("Core", "2.0")) {
      > var myHTMLElement = parent.myFrame. document.docume ntElement;
      > myHTMLElement =
      > parent.myOtherF rame.document.i mportNode(myHTM LElement, true);
      > parent.myOtherF rame.document.r eplaceChild(myH TMLElement,
      > parent.myOtherF rame.document.d ocumentElement) ;
      > }
      > 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]

      Comment

      Working...