The problem with the overwrite the contents of iframe

Discussion in 'JavaScript' started by spheresh, Jun 23, 2009.

  1. #1
    When recording code in the iframe, in the browser status data transmission
    Sample:
    <iframe id="myFrame" framespacing='0' frameborder='no' scrolling='no' width='450' height='100'></iframe>
    <script type="text/javascript" language="JavaScript">
    	var myFrame = document.getElementById('myFrame');
    	var myDocument = myFrame.contentDocument;
    	myDocument.write("<scr"+"ipt type=\"text/javascript\" language=\"JavaScript\" scr=\"http://ads.workserver.test/ads.js\"></scr"+"ipt>");
    </script>
    HTML:
    For example contains in ads.js the file
    alert("i\'am loading");
    HTML:
    script performs correctly

    but the connection status is "Data Transfer", in status bar

    how close the connection?
     
    spheresh, Jun 23, 2009 IP
  2. lp1051

    lp1051 Well-Known Member

    Messages:
    163
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #2
    Hi,

    exactly as you desire and say :)

    myDocument.close();

    after myDocument.write("<scr"+
     
    lp1051, Jun 23, 2009 IP
  3. robbtokill

    robbtokill Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I can't understand a word from what you say, but anyway, I corrected your HTML code. Hope that helps.

    <iframe id="myFrame" framespacing='0' frameborder='no' scrolling='no' width='450' height='100'></iframe>
    <script type="text/javascript" language="JavaScript">
        var myFrame = document.getElementById('myFrame');
        var myDocument = myFrame.contentDocument;
        myDocument.write('<script type="text/javascript" language="JavaScript" src="http://ads.workserver.test/ads.js"></script>');
    </script>
    HTML:
     
    robbtokill, Jun 25, 2009 IP