Copy IFRAME content into DIV

Discussion in 'HTML' started by Floris van den Berg, Sep 13, 2003.

  1. This has probably already asked a million times before but here goes again.
    For the past hours i've been trying to copy the contents of an invisible
    IFRAME to a DIV. Browsed the web a lot for examples, turns out in theory
    it's pretty easy. This is what i did:

    [source]

    <script language="javascript">
    var timer1 = "";
    var done = false;

    function StartWorking(){
    timer1 = window.setInterval("ImWorking()", 100);
    }

    function ImWorking(){
    if (done == true) {
    window.clearInterval(timer1);
    timer1 = "";
    x = document.getElementById("content");
    y = document.getElementById("buffer").document.body;
    x.innerHTML = y.innerHTML;
    }
    }
    </script>

    <div id="content">Old content</div>
    <iframe id="buffer"
    src="https://secure.postplaza.nl/NASApp/tracktrace/FindByBarcodeServlet?BARC
    ODE=3SPSCL50396456&ZIPCODE=3581HJ style="display:none"></iframe>

    <script language="javascript">
    StartWorking()
    </script>

    <script>
    done = true
    </script>

    [/source]

    Needless to say it doesn't work. Instead of the contents of the iframe it
    shows the content of the parent document. I tried to use
    ContentWindow.document.body instead of document.body, and then it doesn't
    show anything at all. Anyone knows what i might be doing wrong? Thanks for
    the assistance.

    Floris
     
    Floris van den Berg, Sep 13, 2003
    #1
    1. Advertising

  2. Floris van den Berg

    Whitecrest Guest

    In article <bjv5k3$be8$>, says...
    > This has probably already asked a million times before but here goes again.
    > For the past hours i've been trying to copy the contents of an invisible
    > IFRAME to a DIV...
    > x = document.getElementById("content");
    > y = document.getElementById("buffer").document.body;
    > x.innerHTML = y.innerHTML;


    try document.frames["buffer"].document.body.innerhtml

    Or a variation on that.

    --
    Whitecrest Entertainment
    www.whitecrestent.com
     
    Whitecrest, Sep 13, 2003
    #2
    1. Advertising

  3. "Whitecrest" <> schreef in bericht
    news:...
    > In article <bjv5k3$be8$>, says...
    > > This has probably already asked a million times before but here goes

    again.
    > > For the past hours i've been trying to copy the contents of an invisible
    > > IFRAME to a DIV...
    > > x = document.getElementById("content");
    > > y = document.getElementById("buffer").document.body;
    > > x.innerHTML = y.innerHTML;

    >
    > try document.frames["buffer"].document.body.innerhtml
    >
    > Or a variation on that.


    Nope. Doesn't work. Tried window.frames["buffer"] too. No avail. Any other
    ideas?

    Floris
     
    Floris van den Berg, Sep 13, 2003
    #3
  4. Floris van den Berg

    Whitecrest Guest

    In article <bjvaol$f8o$>, says...
    > Nope. Doesn't work. Tried window.frames["buffer"] too. No avail. Any other
    > ideas?


    Go to the site in my I load a web page into a <div> that web page can be
    an ASP page, hard coded what ever you want. I believe with playing it
    may achieve the effect you are looking for.

    --
    Whitecrest Entertainment
    www.whitecrestent.com
     
    Whitecrest, Sep 13, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daedalous
    Replies:
    3
    Views:
    825
    Daedalous
    Jan 16, 2004
  2. nc
    Replies:
    0
    Views:
    179
  3. Nathan Carr
    Replies:
    0
    Views:
    295
    Nathan Carr
    Sep 17, 2004
  4. Replies:
    2
    Views:
    127
  5. Joe Attardi
    Replies:
    0
    Views:
    561
    Joe Attardi
    Jan 17, 2006
Loading...

Share This Page