Welcome, Guest
  • Author Topic: Problems getting same-domain IFRAME content  (Read 3420 times)

    david007

    • Seasoned Programmer
    • ***
    • Posts: 127
      • View Profile

    I have an invisible IFRAME, and a visible DIV:
    Code: [Select]
    <div id="text" style="z-index:90;" class="chatWindowTextDisplay"
    title="Chat Transcript - "
    alt="Chat Transcript -"
    ><iframe name[b]="textFrame"[/b] id="textFrame" src="http://localhost/iframeContent.php?cmd=file&file=chatTemplate&template=chatText&amp;site=676789&amp;sessionkey=H9030219168890559071K46359640" frameborder="0" border="0" width="350" height="220" class="chatWindowTextFrame"
    title="Chat Transcript - "
    alt="Chat Transcript - "
    >This functionality requires frames. </a>.</iframe>
    </div>
    invisable iframe:
    Code: [Select]
    document.writeln('<div id="hiddentext" style="z-index:0;position:absolute;[b]visibility:hidden[/b];left:0;top:13px">'+
        '<iframe [b]name="lpCommFrame"[/b] id="lpCommFrame" src="http://localhost/iframecontent.php" frameborder="0" border="0" width="350" height="220" title="Background">'+
        'This functionality requires frames. </iframe>'+
    '</div>');
    I need to copy the content from the lpCommFrame IFRAME, into the textFrame iframe which is inside DIV. Everything
    comes from the same domain, so there are definitely not any cross-domain security issues.

    I was able to get the content of hidden iframe and display it in alert using this code:
                   
                    var win = window.frames['lpCommFrame'];
                    var newtext = win.document.body.innerHTML;
                    alert("textframe"+newtext);

    But how to place that data in to my other frame which is called textFrame? i be happy if some one show me how to copy content of lpCommFrame frame to textFrame frame .Thanks


    « Last Edit: 04/08/07, 13:38 by david007 »

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Problems getting same-domain IFRAME content
    « Reply #1 on: 04/26/07, 02:32 »
    have a look into "innerhtml" command
    happy flashing
    8)
    Ronald