Here is a more precise description of the problem:
This is my javascript function defined in "<head><scriptj avafunction
</script></head>"
section of my html "A" file , which resides on C://A.html
In that directory , there is also a html file "B" with a<body></body>
section in it
and a html file "C" with a<body></bodysection in it : C://B.html,
C://C.html
File A:
"<head><scr ipt>
function load_frame_as_s tring( Framename )
{
var Frame = document.getEle mentsByName(Fra mename)[0];
var Frame_document = Frame.document;
// trying to fetch Body HTML code of file B
var Frame_Body = Frame.document. getElementsByTa gName("body")[0];
var BodyCode = Frame_Body.inne rHTML;
// here the src gets changed from File B to C, and it works
Frame.src="C.ht ml";
alert(BodyCode) ;
return BodyCode;
}
</script</head>
<body>
<iframe width="100" height="100" src="B.html" name="loader1" >
</iframe>
<script type="text/javascript">
load_frame_as_s tring("loader1" )
<script>
</body>
As I said, I can't access the document object of my frame.
Whereas i can change the frame-src by Frame.src="C.ht ml",
i can't access it's Body.
Any Idea?
Thx
"Axel Gallus" <uh**@rz.uni-karlsruhe.desch rieb im Newsbeitrag
news:ef******** **@news2.rz.uni-karlsruhe.de...
>I wrote a javascript function which should return
the html code between a frame's body tag:
function load_frame_as_s tring( Framename )
{
var Frame = document.getEle mentsByName(Fra mename)[0];
var Frame_document = Frame.document;
var Frame_Body = Frame.document. getElementsByTa gName("body")[0];
var BodyCode = Frame_Body.inne rHTML;
alert(BodyCode) ;
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=" www.heise.de"
the location of my whole browser window changes, and not the
frame! What is happening here?
Thx in advance
Axel