triger when document.write is done ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • DJ WIce

    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(docum ent.body.scroll Height)<
    parseInt(docume nt.body.offsetH eight))

    parent.document .getElementById ('iframeID').st yle.height=pars eInt(this.docum e
    nt.body.scrollH eight)+2+'px';
    else

    parent.document .getElementById ('iframeID').st yle.height=pars eInt(this.docum e
    nt.body.offsetH eight)+1+'px';" onload="this.fo cus();"

    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.b ody.scrollHeigh t will return 0px.


    Please help.
    Wouter


  • F. Da Costa

    #2
    Re: triger when document.write is done ?

    DJ WIce wrote:
    [color=blue]
    > 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(docum ent.body.scroll Height)<
    > parseInt(docume nt.body.offsetH eight))
    >
    > parent.document .getElementById ('iframeID').st yle.height=pars eInt(this.docum e
    > nt.body.scrollH eight)+2+'px';
    > else
    >
    > parent.document .getElementById ('iframeID').st yle.height=pars eInt(this.docum e
    > nt.body.offsetH eight)+1+'px';" onload="this.fo cus();"
    >
    > 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.b ody.scrollHeigh t will return 0px.
    >[/color]
    Couldn't you use the onload() function?

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

    //-->
    </script>

    </body>

    Comment

    • DJ WIce

      #3
      Re: triger when document.write is done ?

      : > 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.b ody.scrollHeigh t 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.ht ml"></FRAME>

      in content.html I use <body onfocus="resize script"> and then use:
      document.frames ("iframeID").do cument.body.foc us();
      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


      Comment

      Working...