470,647 Members | 1,085 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,647 developers. It's quick & easy.

triger when document.write is done ?

Hi,

I want to resize an IFRAME.
It works nicely when I try to resize the frame with a commant loaded via

onfocus="if (parseInt(document.body.scrollHeight)<
parseInt(document.body.offsetHeight))

parent.document.getElementById('iframeID').style.h eight=parseInt(this.docume
nt.body.scrollHeight)+2+'px';
else

parent.document.getElementById('iframeID').style.h eight=parseInt(this.docume
nt.body.offsetHeight)+1+'px';" onload="this.focus();"

in the IFRAME body tag.

But I want is to resize the IFRAME when it's content is fully loaded. The
problem is that the content is put in via a javascript.

Even if I put the above lines "if.. else .." under the document.write
commants the this.document.body.scrollHeight will return 0px.
Please help.
Wouter
Jul 20 '05 #1
2 1839
DJ WIce wrote:
Hi,

I want to resize an IFRAME.
It works nicely when I try to resize the frame with a commant loaded via

onfocus="if (parseInt(document.body.scrollHeight)<
parseInt(document.body.offsetHeight))

parent.document.getElementById('iframeID').style.h eight=parseInt(this.docume
nt.body.scrollHeight)+2+'px';
else

parent.document.getElementById('iframeID').style.h eight=parseInt(this.docume
nt.body.offsetHeight)+1+'px';" onload="this.focus();"

in the IFRAME body tag.

But I want is to resize the IFRAME when it's content is fully loaded. The
problem is that the content is put in via a javascript.

Even if I put the above lines "if.. else .." under the document.write
commants the this.document.body.scrollHeight will return 0px.

Couldn't you use the onload() function?

<body>
<script language="JavaScript">
<!--
window.onload = function () {
if (xyz) mickey();
else mouse(true);
...
}

//-->
</script>

</body>
Jul 20 '05 #2
: > But I want is to resize the IFRAME when it's content is fully loaded.
The
: > problem is that the content is put in via a javascript.
: >
: > Even if I put the above lines "if.. else .." under the document.write
: > commants the this.document.body.scrollHeight will return 0px.
: >
: Couldn't you use the onload() function?

No that doesn't work, it seems that the onload is triggered before the
content is written if you use document.write.

I did solve the problem I use
<IFRAME STYLE="display:none;" ID="iframeID" src="content.html"></FRAME>

in content.html I use <body onfocus="resize script"> and then use:
document.frames("iframeID").document.body.focus();
When I make the IFRAME visable in the parent when a mouse clicks.

:-) strange but this works (unless one clicks very fast).
So if you know a way to detect if all document.write comments have been done
it would be nice, it looks like the browser builts/interprets dynamicly, not
in the way the page gives the data even for javascript..

Wouter
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Catherine Lynn Smith | last post: by
9 posts views Thread by James Marshall | last post: by
3 posts views Thread by Jan Ebbe Jensen | last post: by
4 posts views Thread by T Perkins | last post: by
11 posts views Thread by Michael Powe | last post: by
1 post views Thread by Korara | last post: by
reply views Thread by warner | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.