Accessing HTML Code of a frame

Giganews Newsgroups
Subject: Accessing HTML Code of a frame
Posted by:  Axel Gallus (uh…
Date: Tue, 26 Sep 2006

I wrote a javascript function which should return
the html code between a frame's body tag:

function load_frame_as_string( Framename )


  var Frame            = document.getElementsByName(Framename)[0];
  var Frame_document  = Frame.document;
  var Frame_Body        = Frame.document.getElementsByTagName("body")[0];
  var BodyCode            =  Frame_Body.innerHTML;


  return BodyCode;


Interestingly this function doesn't return the body element of the frame,
but the
body element of the parent window in which the frame is.
Also, if i insert Frame_document.location.href=""
the location of my whole browser window changes, and not the
frame! What is happening here?

Thx in advance